summaryrefslogtreecommitdiff
path: root/src/util/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/util.h')
-rwxr-xr-xsrc/util/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util/util.h b/src/util/util.h
new file mode 100755
index 0000000..6f447e6
--- /dev/null
+++ b/src/util/util.h
@@ -0,0 +1,13 @@
+#ifndef UTIL_H
+#define UTIL_H
+
+#define ARRAY_LEN(first, ...) \
+ (sizeof(((typeof(first) []){first, __VA_ARGS__}))/(sizeof(typeof(first))))
+
+#define bool_equal(a,b) ({ \
+ typeof(a) _a = (a); \
+ typeof(b) _b = (b); \
+ ((_a) ? (_b) : (!(_b))); \
+})
+
+#endif