blob: e73d6e9589e9b16d0adabd34bcd839717fdeab4d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/**
* Copyright (c) 2021, Marvin Borner <melvix@marvinborner.de>
* SPDX-License-Identifier: MIT
*/
#ifndef MARFS_DEF_H
#define MARFS_DEF_H
/**
* Types
*/
typedef signed char s8;
typedef unsigned char u8;
typedef signed short s16;
typedef unsigned short u16;
typedef signed int s32;
typedef unsigned int u32;
typedef signed long s64;
typedef unsigned long u64;
typedef float f32;
typedef double f64;
typedef long double f80;
/**
* Useful macros
*/
#define UNUSED(a) ((void)(a))
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#define COUNT(a) (sizeof(a) / sizeof 0 [a])
#define BIT_GET(num, n) (((num) & (1UL << (n))) >> (n))
#define BIT_SET(num, n) ((num) | (1UL << (n)))
#define BIT_CLEAR(num, n) ((num) & ~(1UL << (n)))
#define BIT_TOGGLE(num, n) ((num) ^ (1UL << (n)))
/**
* Compiler attribute wrappers
*/
#define ATTR __attribute__
#define NORETURN ATTR((noreturn))
#define INLINE ATTR((gnu_inline)) inline
#define NOINLINE ATTR((noinline))
#define DEPRECATED ATTR((deprecated))
#define NONNULL ATTR((nonnull))
#define PACKED ATTR((packed))
#define HOT ATTR((hot))
#define OPTIMIZE(level) ATTR((optimize(level)))
#define ALIGNED(align) ATTR((aligned(align)))
/**
* General macro constants
*/
#define NULL ((void *)0)
#endif
|