Loading...
Searching...
No Matches
7#define FURI_RETURNS_NONNULL __attribute__((returns_nonnull))
12 __typeof__(a) _a = (a); \
13 __typeof__(b) _b = (b); \
21 __typeof__(a) _a = (a); \
22 __typeof__(b) _b = (b); \
28#define ABS(a) ({ (a) < 0 ? -(a) : (a); })
32#define ROUND_UP_TO(a, b) \
34 __typeof__(a) _a = (a); \
35 __typeof__(b) _b = (b); \
36 _a / _b + !!(_a % _b); \
41#define CLAMP(x, upper, lower) (MIN(upper, MAX(x, lower)))
45#define COUNT_OF(x) (sizeof(x) / sizeof(x[0]))
49#define FURI_SWAP(x, y) \
57#ifndef PLACE_IN_SECTION
58#define PLACE_IN_SECTION(x) __attribute__((section(x)))
62#define ALIGN(n) __attribute__((aligned(n)))
66#define __weak __attribute__((weak))
70#define UNUSED(X) (void)(X)
74#define STRINGIFY(x) #x
78#define TOSTRING(x) STRINGIFY(x)
82#define CONCATENATE(a, b) CONCATENATE_(a, b)
83#define CONCATENATE_(a, b) a##b
86#ifndef REVERSE_BYTES_U32
87#define REVERSE_BYTES_U32(x) \
88 ((((x) & 0x000000FF) << 24) | (((x) & 0x0000FF00) << 8) | (((x) & 0x00FF0000) >> 8) | \
89 (((x) & 0xFF000000) >> 24))
93#define FURI_BIT(x, n) (((x) >> (n)) & 1)
97#define FURI_BIT_SET(x, n) \
99 __typeof__(x) _x = (1); \
100 (x) |= (_x << (n)); \
104#ifndef FURI_BIT_CLEAR
105#define FURI_BIT_CLEAR(x, n) \
107 __typeof__(x) _x = (1); \
108 (x) &= ~(_x << (n)); \
112#define FURI_SW_MEMBARRIER() asm volatile("" : : : "memory")