Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.

Commit 83973dd

Browse files
authored
Fix
1 parent 3c20350 commit 83973dd

File tree

1 file changed

+0
-35
lines changed

1 file changed

+0
-35
lines changed

kernel/include/util.h

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -28,41 +28,6 @@ typedef u8 bool;
2828

2929
#define NULL (0)
3030

31-
#define CONCAT_IMPL(x, y) x##y
32-
#define CONCAT(x, y) CONCAT_IMPL(x, y)
33-
34-
#define __MIN_IMPL(_x, _y, _xn, _yn) __extension__({\
35-
__typeof__(_x) _xn = (_x);\
36-
__typeof__(_y) _yn = (_y);\
37-
(_xn < _yn ? _xn : _yn);\
38-
})
39-
#define MIN(_x, _y) __MIN_IMPL(_x, _y, CONCAT(__x, __COUNTER__), CONCAT(__y, __COUNTER__))
40-
41-
#define __MAX_IMPL(_x, _y, _xn, _yn) __extension__({\
42-
__typeof__(_x) _xn = (_x);\
43-
__typeof__(_y) _yn = (_y);\
44-
(_xn > _yn ? _xn : _yn);\
45-
})
46-
#define MAX(_x, _y) __MAX_IMPL(_x, _y, CONCAT(__x, __COUNTER__), CONCAT(__y, __COUNTER__))
47-
48-
#define CLAMP(_x, _mi, _ma) (MAX(_mi, MIN(_x, _ma)))
49-
50-
// returns the highest set bit of x
51-
// i.e. if x == 0xF, HIBIT(x) == 3 (4th index)
52-
// WARNING: currently only works for up to 32-bit types
53-
#define HIBIT(_x) (31 - __builtin_clz((_x)))
54-
55-
// returns the lowest set bit of x
56-
#define LOBIT(_x)\
57-
__extension__({ __typeof__(_x) __x = (_x); HIBIT(__x & -__x); })
58-
59-
// returns _v with _n-th bit = _x
60-
#define BIT_SET(_v, _n, _x) __extension__({\
61-
__typeof__(_v) __v = (_v);\
62-
(__v ^ ((-(_x) ^ __v) & (1 << (_n))));\
63-
})
64-
65-
#define PACKED __attribute__((packed))
6631

6732
#ifndef asm
6833
#define asm __asm__ volatile

0 commit comments

Comments
 (0)