chiark / gitweb /
Properly check for overflow in offsets
[elogind.git] / src / shared / macro.h
index 2f151bcc8cb143f5c80d7d33c7de81a2d4c3236f..bfe03f2ae055ce713d07ef16dc53b3cf8a9229bd 100644 (file)
@@ -284,4 +284,7 @@ do {                                                                    \
             sizeof(type) <= 4 ? 10 :                                    \
             sizeof(type) <= 8 ? 20 : sizeof(int[-2*(sizeof(type) > 8)])))
 
+#define SET_FLAG(v, flag, b) \
+        (v) = (b) ? ((v) | (flag)) : ((v) & ~(flag))
+
 #include "log.h"