Skip to content

Commit

Permalink
select: bloom: Squash undefined behaviour sanitiser errors
Browse files Browse the repository at this point in the history
Signed 32-bit shift of 1<<31 is undefined.
  • Loading branch information
tlsa committed Oct 20, 2024
1 parent 3ac1c5e commit 6baad30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/select/bloom.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static inline void css_bloom_add_hash(css_bloom bloom[CSS_BLOOM_SIZE],
unsigned int bit = hash & 0x1f; /* Top 5 bits */
unsigned int index = (hash >> 5) & INDEX_BITS_N; /* Next N bits */

bloom[index] |= (1 << bit);
bloom[index] |= (1u << bit);
}


Expand All @@ -85,7 +85,7 @@ static inline bool css_bloom_has_hash(const css_bloom bloom[CSS_BLOOM_SIZE],
unsigned int bit = hash & 0x1f; /* Top 5 bits */
unsigned int index = (hash >> 5) & INDEX_BITS_N; /* Next N bits */

return (bloom[index] & (1 << bit));
return (bloom[index] & (1u << bit));
}


Expand Down

0 comments on commit 6baad30

Please sign in to comment.