summaryrefslogtreecommitdiff
path: root/src/basic/siphash24.h
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-07-21 04:35:56 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-07-22 19:55:14 +0900
commit6c04fccb1db16e1a3140c01a536bff4ed342f8ed (patch)
treeb2f85aed5c5cfff2fac732103da1c6f8520395ef /src/basic/siphash24.h
parent2859bb932bac2cba0a5200e35b50b404d4e3650e (diff)
downloadsystemd-6c04fccb1db16e1a3140c01a536bff4ed342f8ed.tar.gz
util: make siphash24_compress_boolean() inline
This also changes the stored type from int to uint8_t in order to make hash value endianness independent.
Diffstat (limited to 'src/basic/siphash24.h')
-rw-r--r--src/basic/siphash24.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/basic/siphash24.h b/src/basic/siphash24.h
index 1937fea298..d29058e51d 100644
--- a/src/basic/siphash24.h
+++ b/src/basic/siphash24.h
@@ -17,9 +17,14 @@ struct siphash {
void siphash24_init(struct siphash *state, const uint8_t k[static 16]);
void siphash24_compress(const void *in, size_t inlen, struct siphash *state);
-void siphash24_compress_boolean(bool in, struct siphash *state);
#define siphash24_compress_byte(byte, state) siphash24_compress((const uint8_t[]) { (byte) }, 1, (state))
+static inline void siphash24_compress_boolean(bool in, struct siphash *state) {
+ uint8_t i = in;
+
+ siphash24_compress(&i, sizeof i, state);
+}
+
uint64_t siphash24_finalize(struct siphash *state);
uint64_t siphash24(const void *in, size_t inlen, const uint8_t k[static 16]);