summaryrefslogtreecommitdiffhomepage
path: root/include/stc
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-04 23:24:54 +0100
committerTyge Løvset <[email protected]>2023-02-04 23:24:54 +0100
commitd2ff84c53aa9bd3857fdf22dcf7cd9398a4780be (patch)
tree4923f88afb0d091d5d39ae03d65a4998a0517652 /include/stc
parent626b893b4d9e048c27571bfa28352914f2cd2bbc (diff)
downloadSTC-modified-d2ff84c53aa9bd3857fdf22dcf7cd9398a4780be.tar.gz
STC-modified-d2ff84c53aa9bd3857fdf22dcf7cd9398a4780be.zip
Fix in ccommon.h to make MSVC work again (without -std:c11) + small adjustments.
Diffstat (limited to 'include/stc')
-rw-r--r--include/stc/cbits.h4
-rw-r--r--include/stc/ccommon.h2
2 files changed, 3 insertions, 3 deletions
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 <intrin.h>
- 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__