add meson support
[protos/libecoli.git] / include / ecoli_utils.h
diff --git a/include/ecoli_utils.h b/include/ecoli_utils.h
new file mode 100644 (file)
index 0000000..5a14192
--- /dev/null
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2018, Olivier MATZ <zer0@droids-corp.org>
+ */
+
+#ifndef ECOLI_UTILS_
+#define ECOLI_UTILS_
+
+/**
+ * Cast a variable into a type, ensuring its initial type first
+ */
+#define EC_CAST(x, old_type, new_type) ({      \
+       old_type __x = (x);                     \
+       (new_type)__x;                          \
+       })
+
+#endif