Fix undefined behavior in the macros SET_BH, CLEAR_BH, & ISSET_BH
These macros contain this pattern: 1 << ((Int32_value) & 31 This causes the undefined behavior sanitizers in clang and gcc to complain because the shift, while ultimately stored to an unsigned variable, is done as a signed value. Adding a cast to unsigned for the int32 value resolves this issue.
This commit is contained in:
parent
ad723d6558
commit
451f31b927
@ -202,9 +202,9 @@ void fallbackQSort3 ( UInt32* fmap,
|
|||||||
bhtab [ 0 .. 2+(nblock/32) ] destroyed
|
bhtab [ 0 .. 2+(nblock/32) ] destroyed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define SET_BH(zz) bhtab[(zz) >> 5] |= (1 << ((zz) & 31))
|
#define SET_BH(zz) bhtab[(zz) >> 5] |= ((UInt32)1 << ((zz) & 31))
|
||||||
#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31))
|
#define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~((UInt32)1 << ((zz) & 31))
|
||||||
#define ISSET_BH(zz) (bhtab[(zz) >> 5] & (1 << ((zz) & 31)))
|
#define ISSET_BH(zz) (bhtab[(zz) >> 5] & ((UInt32)1 << ((zz) & 31)))
|
||||||
#define WORD_BH(zz) bhtab[(zz) >> 5]
|
#define WORD_BH(zz) bhtab[(zz) >> 5]
|
||||||
#define UNALIGNED_BH(zz) ((zz) & 0x01f)
|
#define UNALIGNED_BH(zz) ((zz) & 0x01f)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user