mirror of
https://github.com/GrapheneOS/hardened_malloc.git
synced 2025-05-25 01:11:21 -04:00
use consistent wrappers around clz/ffs
This commit is contained in:
parent
86f9c739ee
commit
d8cb2d9f7a
2 changed files with 17 additions and 13 deletions
20
util.h
20
util.h
|
@ -29,8 +29,18 @@
|
|||
#define STRINGIFY(s) #s
|
||||
#define ALIAS(f) __attribute__((alias(STRINGIFY(f))))
|
||||
|
||||
static inline int ffzl(unsigned long x) {
|
||||
return __builtin_ffsl(~x);
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
typedef unsigned __int128 u128;
|
||||
|
||||
static inline int clz64(u64 x) {
|
||||
return __builtin_clzll(x);
|
||||
}
|
||||
|
||||
static inline int ffz64(u64 x) {
|
||||
return __builtin_ffsll(~x);
|
||||
}
|
||||
|
||||
static inline size_t align(size_t size, size_t align) {
|
||||
|
@ -40,12 +50,6 @@ static inline size_t align(size_t size, size_t align) {
|
|||
|
||||
COLD noreturn void fatal_error(const char *s);
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
typedef unsigned __int128 u128;
|
||||
|
||||
#define U64_WIDTH 64
|
||||
|
||||
#if CONFIG_SEAL_METADATA
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue