Fix uatomic sign cast
[userspace-rcu.git] / urcu / compiler.h
index f977b95fdc60f73b6ef6c9ab2b96c4c30a884de2..92867865865f19e45029e0d65c1ee5944c404420 100644 (file)
@@ -85,4 +85,9 @@
 #define URCU_FORCE_CAST(type, arg)     ((type) (arg))
 #endif
 
+#define caa_is_signed_type(type)       (((type) (-1)) < 0)
+
+#define caa_cast_long_keep_sign(v)     \
+       (caa_is_signed_type(__typeof__(v)) ? (long) (v) : (unsigned long) (v))
+
 #endif /* _URCU_COMPILER_H */
This page took 0.02372 seconds and 4 git commands to generate.