Flipper Zero Firmware
Loading...
Searching...
No Matches
dangerous_defines.h
1#pragma once
2
16#ifndef FURI_CONST_ASSIGN
17#define FURI_CONST_ASSIGN_(T, x, y) \
18 ({ \
19 T* tmp_x = (T*)&x; \
20 *tmp_x = y; \
21 *tmp_x; \
22 })
23#define FURI_CONST_ASSIGN_PTR(x, y) \
24 ({ \
25 void** tmp_x = (void**)&x; \
26 *tmp_x = y; \
27 *tmp_x; \
28 })
29#define FURI_CONST_ASSIGN(x, y) \
30 _Generic( \
31 (x), \
32 signed char: FURI_CONST_ASSIGN_(signed char, x, y), \
33 unsigned char: FURI_CONST_ASSIGN_(unsigned char, x, y), \
34 short: FURI_CONST_ASSIGN_(short, x, y), \
35 unsigned short: FURI_CONST_ASSIGN_(unsigned short, x, y), \
36 int: FURI_CONST_ASSIGN_(int, x, y), \
37 unsigned: FURI_CONST_ASSIGN_(unsigned, x, y), \
38 long: FURI_CONST_ASSIGN_(long, x, y), \
39 unsigned long: FURI_CONST_ASSIGN_(unsigned long, x, y), \
40 long long: FURI_CONST_ASSIGN_(long long, x, y), \
41 unsigned long long: FURI_CONST_ASSIGN_(unsigned long long, x, y), \
42 float: FURI_CONST_ASSIGN_(float, x, y), \
43 double: FURI_CONST_ASSIGN_(double, x, y), \
44 long double: FURI_CONST_ASSIGN_(long double, x, y))
45#endif