libc/stdc_has_single_bit.c: fix gcc warning (-Wparentheses)
gcc14 is concerned that the operator precedence between - and & might
be confusing. Throw in some redundant parentheses to make it shut up.
The LLVM build was fine before this change.
Reported by: Martin Filla <freebsd@sysctl.cz>
Approved by: markj (mentor)
MFC after: 1 month
Fixes: 6296500a85
Differential Revision: https://reviews.freebsd.org/D54057
This commit is contained in:
@@ -10,29 +10,29 @@
|
||||
bool
|
||||
stdc_has_single_bit_uc(unsigned char x)
|
||||
{
|
||||
return (x != 0 && (x & x - 1) == 0);
|
||||
return (x != 0 && (x & (x - 1)) == 0);
|
||||
}
|
||||
|
||||
bool
|
||||
stdc_has_single_bit_us(unsigned short x)
|
||||
{
|
||||
return (x != 0 && (x & x - 1) == 0);
|
||||
return (x != 0 && (x & (x - 1)) == 0);
|
||||
}
|
||||
|
||||
bool
|
||||
stdc_has_single_bit_ui(unsigned int x)
|
||||
{
|
||||
return (x != 0 && (x & x - 1) == 0);
|
||||
return (x != 0 && (x & (x - 1)) == 0);
|
||||
}
|
||||
|
||||
bool
|
||||
stdc_has_single_bit_ul(unsigned long x)
|
||||
{
|
||||
return (x != 0 && (x & x - 1) == 0);
|
||||
return (x != 0 && (x & (x - 1)) == 0);
|
||||
}
|
||||
|
||||
bool
|
||||
stdc_has_single_bit_ull(unsigned long long x)
|
||||
{
|
||||
return (x != 0 && (x & x - 1) == 0);
|
||||
return (x != 0 && (x & (x - 1)) == 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user