Skip to content

Commit 41340e5

Browse files
committed
endian.h: use parentheses to avoid compilation errors with clang
This fixes errors like: include/endian.h:26:41: error: '&' within '|' [-Werror,-Wbitwise-op-parentheses] Signed-off-by: Matheus Tavares Bernardino <matheus.bernardino@oss.qualcomm.com>
1 parent 14fd167 commit 41340e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

include/endian.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ static __inline uint16_t __bswap16(uint16_t __x)
2323

2424
static __inline uint32_t __bswap32(uint32_t __x)
2525
{
26-
return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
26+
return __x>>24 | ((__x>>8)&0xff00) | ((__x<<8)&0xff0000) | __x<<24;
2727
}
2828

2929
static __inline uint64_t __bswap64(uint64_t __x)
3030
{
31-
return __bswap32(__x)+0ULL<<32 | __bswap32(__x>>32);
31+
return (__bswap32(__x)+0ULL)<<32 | __bswap32(__x>>32);
3232
}
3333

3434
#if __BYTE_ORDER == __LITTLE_ENDIAN

0 commit comments

Comments
 (0)