diff options
author | Ian Moffett <ian@osmora.org> | 2024-06-04 17:37:24 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-06-04 17:37:24 -0400 |
commit | 4f8e9e197cd55a4a7b05a782996d66a9ca1b212f (patch) | |
tree | f52b23e1b14dcc7138775d1b77ae0235521f7fac /sys/include | |
parent | f7ec58662269f08e025b52d83034f73f4975f878 (diff) |
kernel: Add bitmap helper macros
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/include')
-rw-r--r-- | sys/include/sys/param.h | 5 |
1 files changed, 5 insertions, 0 deletions
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_ */ |