Add slot allocator

This commit is contained in:
Nils O. Selåsdal
2025-07-21 19:57:26 +02:00
parent 7408c48dff
commit 251246924d
6 changed files with 188 additions and 12 deletions
+4 -4
View File
@@ -30,7 +30,7 @@
// int i;
// struct bar zap;
//};
// ...
// ...
//struct bar *p = ..; //the local p is a pointer to
//a 'zap' member inside a struct foo.
//give us the struct foo*:
@@ -55,7 +55,7 @@ const typeof( ((const type *)0)->member ) *__mptr = (ptr); \
/**
* Test if x is a power of 2
*
*
* @param x value, must be an unsigned type
* @return 1 if x is a power of 20, 0 if it is not
*/
@@ -90,7 +90,7 @@ const typeof( ((const type *)0)->member ) *__mptr = (ptr); \
*
* @param x numerator, must be positive
* @param y denominator
* @return x/y rounded up
* @return x/y rounded up
*/
#define UC_DIV_ROUND_UP(x, y) (((x) + ((y) - 1))/(y))
@@ -103,7 +103,7 @@ const typeof( ((const type *)0)->member ) *__mptr = (ptr); \
* @param y denominator
* @return x rounded up to nearest multiple of y
*/
#define UC_ROUND_UP(x, y) (UC_DIV_ROUND_UP((x), (y)) * (y))
#define UC_ROUND_UP(x, y) (UC_DIV_ROUND_UP((x), (y)) * (y))
/**
* Round x down to nearest multiple of y