From 4f8e9e197cd55a4a7b05a782996d66a9ca1b212f Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Tue, 4 Jun 2024 17:37:24 -0400 Subject: kernel: Add bitmap helper macros Signed-off-by: Ian Moffett --- sys/include/sys/param.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sys') diff --git a/sys/include/sys/param.h b/sys/include/sys/param.h index 7631057..91566ae 100644 --- a/sys/include/sys/param.h +++ b/sys/include/sys/param.h @@ -38,6 +38,11 @@ #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #define MAX(a,b) (((a) > (b)) ? (a) : (b)) +/* Bitmap helper macros */ +#define setbit(a, b) ((a)[(b) >> 3] |= BIT(b % 8)) +#define clrbit(a, b) ((a)[(b) >> 3] &= ~BIT(b % 8)) +#define testbit(a, b) (ISSET((a)[(b) >> 3], BIT(b % 8))) + #define NELEM(a) (sizeof(a) / sizeof(a[0])) #endif /* _SYS_PARAM_H_ */ -- cgit v1.2.3