diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-16 11:12:11 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-16 11:12:11 +0000 |
commit | b88595eb72302cf40e13b78e2d2917c7e98b66c4 (patch) | |
tree | fb29ee92acc433261b128462e8d556374fc5299a /src/select | |
parent | d27f9ac52cd51d84df24074fa3d2f3fe57bb987c (diff) | |
download | libcss-b88595eb72302cf40e13b78e2d2917c7e98b66c4.tar.gz libcss-b88595eb72302cf40e13b78e2d2917c7e98b66c4.tar.bz2 |
Bloom: Init: Switch to memset.
GCC is a bit better at optimising a memset.
For clang it makes no difference.
Diffstat (limited to 'src/select')
-rw-r--r-- | src/select/bloom.h | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/select/bloom.h b/src/select/bloom.h index 90328cc..dda4cca 100644 --- a/src/select/bloom.h +++ b/src/select/bloom.h @@ -32,6 +32,7 @@ #define libcss_bloom_h_ #include <stdint.h> +#include <string.h> /* Size of bloom filter as multiple of 32 bits. * Has to be 4, 8, or 16. @@ -179,27 +180,7 @@ static inline void css_bloom_merge( */ static inline void css_bloom_init(css_bloom bloom[CSS_BLOOM_SIZE]) { - bloom[0] = 0; - bloom[1] = 0; - bloom[2] = 0; - bloom[3] = 0; -#if (CSS_BLOOM_SIZE > 4) - bloom[4] = 0; - bloom[5] = 0; - bloom[6] = 0; - bloom[7] = 0; -#endif -#if (CSS_BLOOM_SIZE > 8) - bloom[8] = 0; - bloom[9] = 0; - bloom[10] = 0; - bloom[11] = 0; - bloom[12] = 0; - bloom[13] = 0; - bloom[14] = 0; - bloom[15] = 0; -#endif + memset(bloom, 0, sizeof(*bloom) * CSS_BLOOM_SIZE); } #endif - |