summaryrefslogtreecommitdiffhomepage
path: root/include/stc/ccommon.h
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-07-07 17:21:22 +0200
committerTyge Løvset <[email protected]>2023-07-07 17:21:22 +0200
commit3a26c8fe4bce8a3af62042dd0fca5f36221359a9 (patch)
treedfa0d899d8b28b4c0f04b66075dd41ceaea24732 /include/stc/ccommon.h
parentd8c1a999cc566b8943003ad5281abc6eefcda519 (diff)
downloadSTC-modified-3a26c8fe4bce8a3af62042dd0fca5f36221359a9.tar.gz
STC-modified-3a26c8fe4bce8a3af62042dd0fca5f36221359a9.zip
Issue #62: Fixed wrong printf format specifiers. Changed cbits.h to use long long (guaranteed at least 64-bit) instead of int64_t for easier print.
Second part of #62 is due to a clang compiler bug, can be avoided by using c_foreach instead of c_forpair.
Diffstat (limited to 'include/stc/ccommon.h')
-rw-r--r--include/stc/ccommon.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 63ce5b09..6f42bcc1 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -30,6 +30,7 @@
#include <string.h>
#include <assert.h>
+typedef long long _llong;
#define c_NPOS INTPTR_MAX
#define c_ZI PRIiPTR
#define c_ZU PRIuPTR
@@ -200,9 +201,9 @@ STC_INLINE intptr_t cnextpow2(intptr_t n) {
#define c_forrange_1(stop) c_forrange_3(_c_i, 0, stop)
#define c_forrange_2(i, stop) c_forrange_3(i, 0, stop)
#define c_forrange_3(i, start, stop) \
- for (long long i=start, _end=(long long)(stop); i < _end; ++i)
+ for (_llong i=start, _end=(_llong)(stop); i < _end; ++i)
#define c_forrange_4(i, start, stop, step) \
- for (long long i=start, _inc=step, _end=(long long)(stop) - (_inc > 0) \
+ for (_llong i=start, _inc=step, _end=(_llong)(stop) - (_inc > 0) \
; (_inc > 0) ^ (i > _end); i += _inc)
#ifndef __cplusplus