libfuse: lib/util.h Source File

libfuse

util.h
1#ifndef FUSE_UTIL_H_
2#define FUSE_UTIL_H_
3
4#include <stdint.h>
5
6#define ROUND_UP(val, round_to) (((val) + (round_to - 1)) & ~(round_to - 1))
7
8#define likely(x) __builtin_expect(!!(x), 1)
9#define unlikely(x) __builtin_expect(!!(x), 0)
10
11int libfuse_strtol(const char *str, long *res);
12
16static inline uint32_t fuse_lower_32_bits(uint64_t nr)
17{
18 return (uint32_t)(nr & 0xffffffff);
19}
20
24static inline uint64_t fuse_higher_32_bits(uint64_t nr)
25{
26 return nr & ~0xffffffffULL;
27}
28
29#ifndef FUSE_VAR_UNUSED
30#define FUSE_VAR_UNUSED(var) (__attribute__((unused)) var)
31#endif
32
33#endif