Browse Source

iconv: explicitly state operator precedence

gcc suggests to set parentheses around '-'/'+' inside '<<' if the
corresponding warnings are enabled. Make the compiler happy and make
the code easier to understand for developers.

Signed-off-by: Marcus Haehnel <marcus.haehnel@kernkonzept.com>
Frank Mehnert 9 months ago
parent
commit
eef17b2616
1 changed files with 2 additions and 2 deletions
  1. 2 2
      libiconv/iconv.c

+ 2 - 2
libiconv/iconv.c

@@ -199,7 +199,7 @@ static void put_16(unsigned char *s, unsigned c, int e)
 static unsigned get_32(const unsigned char *s, int e)
 {
 	e &= 3;
-	return s[e]+0U<<24 | s[e^1]<<16 | s[e^2]<<8 | s[e^3];
+	return (s[e]+0U)<<24 | s[e^1]<<16 | s[e^2]<<8 | s[e^3];
 }
 
 static void put_32(unsigned char *s, unsigned c, int e)
@@ -331,7 +331,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];
 }