aboutsummaryrefslogtreecommitdiffstats
path: root/src/util.h
diff options
context:
space:
mode:
authornathansmith117 <nathansmith117@sdf.org>2025-02-03 13:46:19 +0000
committernathansmith117 <nathansmith117@sdf.org>2025-02-03 13:46:19 +0000
commit305c224104be6558f2ece595a47cf29348b60d66 (patch)
treef36af90ce04dade5b520a24c77176ca7ebb4ef65 /src/util.h
downloadsldj-305c224104be6558f2ece595a47cf29348b60d66.tar.gz
sldj-305c224104be6558f2ece595a47cf29348b60d66.tar.bz2
sldj-305c224104be6558f2ece595a47cf29348b60d66.zip
first commit
Diffstat (limited to 'src/util.h')
-rw-r--r--src/util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util.h b/src/util.h
new file mode 100644
index 0000000..110aae7
--- /dev/null
+++ b/src/util.h
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#ifndef UTIL_H
+#define UTIL_H
+
+#define SET_BIT(b, n) (b | (0x1 << n))
+#define CLEAR_BIT(b, n) (b & ~(0x1 << n))
+#define IS_BIT_SET(b, n) ((b >> n) & 0x1)
+#define TOGGLE_BIT(b, n) (b ^ (0x1 << n))
+#define HAS_FLAG(v, f) ((v & f) == f)
+
+#endif