-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathmclib.h
More file actions
35 lines (26 loc) · 746 Bytes
/
Copy pathmclib.h
File metadata and controls
35 lines (26 loc) · 746 Bytes
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
/**
* mclib.h
*
* Common library utilities.
*/
#ifndef __MCLIB_H
#define __MCLIB_H
/**
* Stringify (add quotes to) the bare word argument
*/
#define __str_quote(...) #__VA_ARGS__
/**
* Wrapper for __test_command allowing bare words
*/
#define TEST_CMD(...) __test_command(__str_quote(__VA_ARGS__))
/**
* Inject the command (bare words) into the resulting ASM
*/
#define CMD(...) __asm__(__str_quote(CMD __VA_ARGS__))
/**
* Swaps the value of the two arguments without the use of a temporary variable
*/
#define ASM_swap(a, b) __asm__("XCHG >?, >?", a, b)
#define EVENT_CONDITION(cond) _Pragma("event_condition cond")
#define EVENT(event, cond, name) _Pragma("event_handler event") cond void name()
#endif /* __MCLIB_H */