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 ++-- include/stc/ccommon.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'include') 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; diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h index 30184407..b8ea6316 100644 --- a/include/stc/ccommon.h +++ b/include/stc/ccommon.h @@ -52,7 +52,7 @@ /* Macro overloading feature support based on: https://rextester.com/ONP80107 */ #define c_MACRO_OVERLOAD(name, ...) \ - c_PASTE(name##_, c_NUMARGS(__VA_ARGS__))(__VA_ARGS__) + c_PASTE(c_CONCAT(name,_), c_NUMARGS(__VA_ARGS__))(__VA_ARGS__) #define c_CONCAT(a, b) a ## b #define c_PASTE(a, b) c_CONCAT(a, b) #define c_EXPAND(...) __VA_ARGS__ -- cgit v1.2.3