summaryrefslogtreecommitdiffhomepage
path: root/include/mp-bit.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/mp-bit.h')
-rw-r--r--include/mp-bit.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/mp-bit.h b/include/mp-bit.h
new file mode 100644
index 0000000..58111a3
--- /dev/null
+++ b/include/mp-bit.h
@@ -0,0 +1,18 @@
+// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Distributed under the Apache Software License, Version 2.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.apache.org/licenses/LICENSE-2.0)
+// Official repository: https://github.com/nekernel-org/neboot
+
+#ifndef __BITMANIP_H__
+#define __BITMANIP_H__
+
+/// Name: NeBoot Bits API.
+/// Purpose: Bit manip helpers.
+
+#define cb_set_bit(X, O) X = (1 << O) | X
+#define cb_clear_bit(X, O) X = ~(1 << O) & X
+#define cb_toogle(X, O) X = (1 << O) ^ X
+#define cb_lsb(X) X = X & -X
+#define cb_msb(X) X = -(cb_lsb(X)) & X
+
+#endif // ifndef __BITMANIP_H__