From: "Zhao, Weiming" <weimingz@codeaurora.org>
To: musl@lists.openwall.com
Subject: Fix warnings when build with clang
Date: Fri, 24 Jun 2016 17:18:23 -0700 [thread overview]
Message-ID: <ba062fcb-0918-6b4a-019b-53fd3fad18ad@codeaurora.org> (raw)
[-- Attachment #1: Type: text/plain, Size: 674 bytes --]
Clang gives warnings about the missing parentheses for bitwise ops.
It's not functional but just code readability.
musl-m3/include/endian.h:32:25: warning: '&' within '|'
[-Wbitwise-op-parentheses]
return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
~ ~~~~~~^~~~~~~
musl-m3/include/endian.h:37:23: warning: operator '<<' has lower
precedence than '+'; '+' will be evaluated first [-Wshift-op-parentheses]
return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
~~~~~~~~~~~~~~^~~~~~~
Thanks,
Weiming
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[-- Attachment #2: musl.patch --]
[-- Type: text/plain, Size: 589 bytes --]
diff --git a/include/endian.h b/include/endian.h
index 1bd4445..88c3347 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -29,12 +29,12 @@ static __inline uint16_t __bswap16(uint16_t __x)
static __inline uint32_t __bswap32(uint32_t __x)
{
- return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
+ return __x>>24 | (__x>>8&0xff00) | (__x<<8&0xff0000) | __x<<24;
}
static __inline uint64_t __bswap64(uint64_t __x)
{
- return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
+ return (__bswap32(__x)+0ULL)<<32 | __bswap32(__x>>32);
}
#if __BYTE_ORDER == __LITTLE_ENDIAN
next reply other threads:[~2016-06-25 0:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-25 0:18 Zhao, Weiming [this message]
2016-06-25 9:37 ` Szabolcs Nagy
2016-06-27 17:01 ` weimingz
2016-06-27 17:21 ` Rich Felker
2016-06-27 17:30 ` Zhao, Weiming
2016-06-27 17:41 ` Luca Barbato
2016-06-27 17:55 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ba062fcb-0918-6b4a-019b-53fd3fad18ad@codeaurora.org \
--to=weimingz@codeaurora.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).