aboutsummaryrefslogtreecommitdiff
path: root/src/stdlib/siphash.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-03-28 15:31:53 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-03-28 15:31:53 -0400
commitca76fb335ae7b3f820beeeed5667950e7489711e (patch)
treee0ef48cce92aeeb92241ef98c65bf3af84c05ca4 /src/stdlib/siphash.c
parent4de0fee8f694503b453e04084caaab55f8670b6c (diff)
Add compiler guards for GCC directives
Diffstat (limited to 'src/stdlib/siphash.c')
-rw-r--r--src/stdlib/siphash.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/stdlib/siphash.c b/src/stdlib/siphash.c
index 44e8b6eb..274b3195 100644
--- a/src/stdlib/siphash.c
+++ b/src/stdlib/siphash.c
@@ -49,13 +49,17 @@ public uint64_t TOMO_HASH_KEY[2] = {23, 42}; // Randomized in tomo_init()
PUREFUNC public uint64_t siphash24(const uint8_t *src, size_t src_sz) {
siphash sh;
if ((uint64_t)src % __alignof__(uint64_t) == 0) {
+#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
+#endif
const uint64_t *in = (uint64_t*)src;
/* Find largest src_sz evenly divisible by 8 bytes. */
const ptrdiff_t src_sz_nearest_8bits = ((ptrdiff_t)src_sz >> 3) << 3;
const uint64_t *goal = (uint64_t*)(src + src_sz_nearest_8bits);
+#ifdef __GNUC__
#pragma GCC diagnostic pop
+#endif
siphashinit(&sh, src_sz);
src_sz -= (size_t)src_sz_nearest_8bits;
while (in < goal) {