diff options
Diffstat (limited to 'crypto/openssh/libcrux_mlkem768_sha3.h')
-rw-r--r-- | crypto/openssh/libcrux_mlkem768_sha3.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/openssh/libcrux_mlkem768_sha3.h b/crypto/openssh/libcrux_mlkem768_sha3.h index b8ac1436f218..885e82bafa06 100644 --- a/crypto/openssh/libcrux_mlkem768_sha3.h +++ b/crypto/openssh/libcrux_mlkem768_sha3.h @@ -177,10 +177,14 @@ static inline uint32_t core_num__u32_8__from_le_bytes(uint8_t buf[4]) { } static inline uint32_t core_num__u8_6__count_ones(uint8_t x0) { -#ifdef _MSC_VER +#if defined(_MSC_VER) return __popcnt(x0); -#else +#elif !defined(MISSING_BUILTIN_POPCOUNT) return __builtin_popcount(x0); +#else + const uint8_t v[16] = { 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4 }; + return v[x0 & 0xf] + v[(x0 >> 4) & 0xf]; + #endif } |