summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/include/sys/param.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/sys/include/sys/param.h b/sys/include/sys/param.h
index d6c5a2b..a35a094 100644
--- a/sys/include/sys/param.h
+++ b/sys/include/sys/param.h
@@ -47,6 +47,11 @@
#define clrbit(a, b) ((a)[(b) >> 3] &= ~BIT(b % 8))
#define testbit(a, b) (ISSET((a)[(b) >> 3], BIT(b % 8)))
+/* Combine bits */
+#define COMBINE8(h, l) ((uint16_t)((uint16_t)(h) << 8) | (l))
+#define COMBINE16(h, l) ((uint32_t)((uint32_t)(h) << 16) | (l))
+#define COMBINE32(h, l) ((uint64_t)((uint64_t)(h) << 32) | (l))
+
#define NELEM(a) (sizeof(a) / sizeof(a[0]))
#endif /* _SYS_PARAM_H_ */