From d2ff84c53aa9bd3857fdf22dcf7cd9398a4780be Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sat, 4 Feb 2023 23:24:54 +0100 Subject: Fix in ccommon.h to make MSVC work again (without -std:c11) + small adjustments. --- include/stc/cbits.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/stc/cbits.h') diff --git a/include/stc/cbits.h b/include/stc/cbits.h index 9f0afc9c..577ecb13 100644 --- a/include/stc/cbits.h +++ b/include/stc/cbits.h @@ -60,10 +60,10 @@ int main() { #define _cbits_bytes(n) (_cbits_words(n) * c_sizeof(uint64_t)) #if defined(__GNUC__) || defined(__clang__) - STC_INLINE int cpopcount64(uint64_t x) {return (int)__builtin_popcountll(x);} + STC_INLINE int cpopcount64(uint64_t x) {return __builtin_popcountll(x);} #elif defined(_MSC_VER) && defined(_WIN64) #include - STC_INLINE int cpopcount64(uint64_t x) {return __popcnt64(x);} + STC_INLINE int cpopcount64(uint64_t x) {return (int)__popcnt64(x);} #else STC_INLINE int cpopcount64(uint64_t x) { /* http://en.wikipedia.org/wiki/Hamming_weight */ x -= (x >> 1) & 0x5555555555555555; -- cgit v1.2.3