summaryrefslogtreecommitdiffhomepage
path: root/include/stc/ccommon.h
diff options
context:
space:
mode:
authortylov <[email protected]>2023-07-15 23:20:16 +0200
committertylov <[email protected]>2023-07-15 23:20:16 +0200
commite9121702a5d69624ef1e782e85a8f032e4f4e875 (patch)
tree00e7770c9b775d98b518d9e3929b6ec4f71ad754 /include/stc/ccommon.h
parent23aebb77554bc43c929704e9f1c46dc4520024df (diff)
downloadSTC-modified-e9121702a5d69624ef1e782e85a8f032e4f4e875.tar.gz
STC-modified-e9121702a5d69624ef1e782e85a8f032e4f4e875.zip
Improved warning, and other enhancements in ccommon.h
Diffstat (limited to 'include/stc/ccommon.h')
-rw-r--r--include/stc/ccommon.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/include/stc/ccommon.h b/include/stc/ccommon.h
index 45c3a360..1f9ea80d 100644
--- a/include/stc/ccommon.h
+++ b/include/stc/ccommon.h
@@ -85,7 +85,7 @@ typedef long long _llong;
#define c_assert(expr) assert(expr)
#endif
#define c_container_of(p, C, m) ((C*)((char*)(1 ? (p) : &((C*)0)->m) - offsetof(C, m)))
-#define c_const_cast(T, p) ((T)(p) + 0*sizeof((T)0 == (p)))
+#define c_const_cast(T, p) ((T)(1 ? (p) : (T)0))
#define c_swap(T, xp, yp) do { T *_xp = xp, *_yp = yp, \
_tv = *_xp; *_xp = *_yp; *_yp = _tv; } while (0)
#define c_sizeof (intptr_t)sizeof
@@ -96,8 +96,8 @@ typedef long long _llong;
#define c_memmove(d, s, ilen) memmove(d, s, c_i2u(ilen))
#define c_memset(d, val, ilen) memset(d, val, c_i2u(ilen))
#define c_memcmp(a, b, ilen) memcmp(a, b, c_i2u(ilen))
-#define c_u2i(u) ((intptr_t)((u) + 0*sizeof((u) == 1U)))
-#define c_i2u(i) ((size_t)(i) + 0*sizeof((i) == 1))
+#define c_u2i(u) ((intptr_t)(1 ? (u) : (size_t)1))
+#define c_i2u(i) ((size_t)(1 ? (i) : (intptr_t)1))
#define c_LTu(a, b) ((size_t)(a) < (size_t)(b))
// x and y are i_keyraw* type, defaults to i_key*: