From 869bcd5b2f4fd862c02d305dae10e9df835a91c8 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 20 Oct 2024 12:29:39 +0100 Subject: [PATCH] select: bloom: Squash undefined behaviour sanitiser errors Signed 32-bit shift of 1<<31 is undefined. --- src/select/bloom.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/select/bloom.h b/src/select/bloom.h index dda4cca..baba48f 100644 --- a/src/select/bloom.h +++ b/src/select/bloom.h @@ -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); } @@ -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)); }