From 305c224104be6558f2ece595a47cf29348b60d66 Mon Sep 17 00:00:00 2001 From: nathansmith117 Date: Mon, 3 Feb 2025 06:46:19 -0700 Subject: first commit --- src/util.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/util.h (limited to 'src/util.h') 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 +#include + +#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 -- cgit v1.2.3