mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Issam Maghni <me@concati.me>
To: musl@lists.openwall.com
Cc: Issam Maghni <me@concati.me>
Subject: [PATCH 3/5] fix warning bitwise-op-parentheses
Date: Mon, 22 Jul 2019 14:07:38 -0400	[thread overview]
Message-ID: <20190722180740.16951-3-me@concati.me> (raw)
In-Reply-To: <20190722180740.16951-1-me@concati.me>

Signed-off-by: Issam Maghni <me@concati.me>
---
 include/byteswap.h       | 2 +-
 include/endian.h         | 2 +-
 src/locale/__mo_lookup.c | 2 +-
 src/locale/iconv.c       | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/include/byteswap.h b/include/byteswap.h
index 00b9df3c..861c3aa1 100644
--- a/include/byteswap.h
+++ b/include/byteswap.h
@@ -11,7 +11,7 @@ static __inline uint16_t __bswap_16(uint16_t __x)
 
 static __inline uint32_t __bswap_32(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 __bswap_64(uint64_t __x)
diff --git a/include/endian.h b/include/endian.h
index 1bd44451..60716508 100644
--- a/include/endian.h
+++ b/include/endian.h
@@ -29,7 +29,7 @@ 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)
diff --git a/src/locale/__mo_lookup.c b/src/locale/__mo_lookup.c
index d18ab774..fac204e2 100644
--- a/src/locale/__mo_lookup.c
+++ b/src/locale/__mo_lookup.c
@@ -3,7 +3,7 @@
 
 static inline uint32_t swapc(uint32_t x, int c)
 {
-	return c ? x>>24 | x>>8&0xff00 | x<<8&0xff0000 | x<<24 : x;
+	return c ? x>>24 | (x>>8&0xff00) | (x<<8&0xff0000) | x<<24 : x;
 }
 
 const char *__mo_lookup(const void *p, size_t size, const char *s)
diff --git a/src/locale/iconv.c b/src/locale/iconv.c
index ecb57bc2..28c7709e 100644
--- a/src/locale/iconv.c
+++ b/src/locale/iconv.c
@@ -201,7 +201,7 @@ static unsigned legacy_map(const unsigned char *map, unsigned c)
 {
 	if (c < 4*map[-1]) return c;
 	unsigned x = c - 4*map[-1];
-	x = map[x*5/4]>>2*x%8 | map[x*5/4+1]<<8-2*x%8 & 1023;
+	x = map[x*5/4]>>2*x%8 | (map[x*5/4+1]<<8-2*x%8 & 1023);
 	return x < 256 ? x : legacy_chars[x-256];
 }
 
-- 
2.22.0



  parent reply	other threads:[~2019-07-22 18:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 18:07 [PATCH 1/5] fix warning dangling-else Issam Maghni
2019-07-22 18:07 ` [PATCH 2/5] fix warning logical-op-parentheses Issam Maghni
2019-07-22 18:07 ` Issam Maghni [this message]
2019-07-22 18:07 ` [PATCH 4/5] fix warning shift-op-parentheses Issam Maghni
2019-07-22 18:07 ` [PATCH 5/5] fix warning parentheses Issam Maghni
2019-07-22 18:50 ` [PATCH 1/5] fix warning dangling-else A. Wilcox
2019-07-22 20:50 ` Rich Felker
2019-07-23  2:31   ` Fangrui Song
2019-07-23  3:38     ` Rich Felker
2019-07-23  4:06       ` Fangrui Song
2019-07-23  4:25         ` 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=20190722180740.16951-3-me@concati.me \
    --to=me@concati.me \
    --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).