Skip to content

Commit

Permalink
fix some overflow UB
Browse files Browse the repository at this point in the history
  • Loading branch information
panstromek committed Feb 20, 2022
1 parent 3416efd commit 46a55d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bitbtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ static const unsigned int high_flip[56] = {
#define bbFlips_Right_low(pos, mask) \
contig = right_contiguous[(opp_bits_low >> (pos + 1)) & mask]; \
fl = right_flip[contig] << (pos + 1); \
t = -(int)(my_bits_low & fl) >> 31; \
t = ((int)(-(unsigned int)(my_bits_low & fl))) >> 31u; \
my_bits_low |= fl & t; \
flipped = contig & t
#endif
Expand Down Expand Up @@ -775,7 +775,7 @@ static const unsigned int high_flip[56] = {
t &= (opp_bits_high >> (pos + vec * 3 - 32)); \
contig += t; \
fl = lsb_mask[contig] & mask; \
t = -(int)(my_bits_high & fl) >> 31; \
t = ((int)(-(unsigned int)(my_bits_high & fl))) >> 31u; \
my_bits_high |= fl & t; \
flipped += contig & t; \
}
Expand Down

0 comments on commit 46a55d0

Please sign in to comment.