kernel: adjust formatting
This commit is contained in:
+13
-6
@@ -1,27 +1,34 @@
|
||||
#ifndef MANGO_UTIL_H_
|
||||
#define MANGO_UTIL_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
#define MAX(x, y) ((x) > (y) ? (x) : (y))
|
||||
#define CLAMP(x, lo, hi) (MIN(MAX(x, lo), hi))
|
||||
|
||||
extern uint64_t hash_string(const char *s);
|
||||
extern void data_size_to_string(size_t value, char *out, size_t outsz);
|
||||
static inline bool power_of_2(size_t x) { return (x > 0 && (x & (x - 1)) == 0); }
|
||||
static inline unsigned long long div64_pow2(unsigned long long x, unsigned long long y)
|
||||
static inline bool power_of_2(size_t x)
|
||||
{
|
||||
return (x > 0 && (x & (x - 1)) == 0);
|
||||
}
|
||||
static inline unsigned long long div64_pow2(
|
||||
unsigned long long x,
|
||||
unsigned long long y)
|
||||
{
|
||||
return x >> (__builtin_ctz(y));
|
||||
}
|
||||
|
||||
static inline unsigned long long absdiff64(unsigned long long x, unsigned long long y)
|
||||
static inline unsigned long long absdiff64(
|
||||
unsigned long long x,
|
||||
unsigned long long y)
|
||||
{
|
||||
return x < y ? y - x : x - y;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user