From 17964e095f44c0a7375f3af432baefc8ba3fd430 Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 17 Jul 2022 15:04:30 +0000 Subject: [PATCH] fixed sip_init_v_bin for big endian systems --- hio/lib/utl-siph.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/hio/lib/utl-siph.c b/hio/lib/utl-siph.c index 77a51bd..1791155 100644 --- a/hio/lib/utl-siph.c +++ b/hio/lib/utl-siph.c @@ -75,7 +75,6 @@ typedef struct sip_uint64_t sip_uint64_t; # error UNKNOWN ENDIAN #endif - #define U8TO64_LE(p) u8to64_le(p) static HIO_INLINE sip_uint64_t u8to64_le (const hio_uint8_t* p) { @@ -136,10 +135,19 @@ static HIO_INLINE sip_uint64_t* xor64_to (sip_uint64_t* v, sip_uint64_t s) static const hio_uint8_t sip_init_v_bin[] = { +#if defined(HIO_ENDIAN_LITTLE) 0x75, 0x65, 0x73, 0x70, 0x65, 0x6d, 0x6f, 0x73, 0x6d, 0x6f, 0x64, 0x6e, 0x61, 0x72, 0x6f, 0x64, 0x61, 0x72, 0x65, 0x6e, 0x65, 0x67, 0x79, 0x6c, 0x73, 0x65, 0x74, 0x79, 0x62, 0x64, 0x65, 0x74 +#elif defined(HIO_ENDIAN_BIG) + 0x73, 0x6f, 0x6d, 0x65, 0x70, 0x73, 0x65, 0x75, + 0x64, 0x6f, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, + 0x6c, 0x79, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, + 0x74, 0x65, 0x64, 0x62, 0x79, 0x74, 0x65, 0x73 +#else +# error UNKNOWN ENDIAN +#endif }; #define sip_init_v (*(sip_uint64_t(*)[4])sip_init_v_bin)