Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 96e1873

Browse files
committed
Init macro directory
Signed-off-by: Seungha Son <seungha.son@samsung.com>
1 parent b18f574 commit 96e1873

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

‎macro/s_macros.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef __S_MACROS_H__
2+
#define __S_MACROS_H__
3+
4+
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
5+
#define _S_BOOLEAN_EXPR(expr) \
6+
S_GNUC_EXTENSION ({ \
7+
int _s_boolean_var_; \
8+
if (expr) \
9+
_s_boolean_var_ = 1; \
10+
else \
11+
_s_boolean_var_ = 0; \
12+
_s_boolean_var_; \
13+
})
14+
#define S_LIKELY(expr) (__builtin_expect (_S_BOOLEAN_EXPR((expr)), 1))
15+
#define S_UNLIKELY(expr) (__builtin_expect (_S_BOOLEAN_EXPR((expr)), 0))
16+
#else
17+
#define S_LIKELY(expr) (expr)
18+
#define S_UNLIKELY(expr) (expr)
19+
#endif
20+
21+
#ifndef TRUE
22+
#define TRUE 1
23+
#endif
24+
25+
#ifndef FALSE
26+
#define FALSE 0
27+
#endif
28+
29+
#endif /* __S_MACROTS_H__ */

‎macro/s_type_conversion.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#ifndef __S_TYPE_CONVERSION_H__
2+
#define __S_TYPE_CONVERSION_H__
3+
4+
#define SINT_TO_POINTER(x) ((void *)(long)(x))
5+
#define SPOINTER_TO_INT(x) ((int)(long)(x))
6+
#define SUINT_TO_POINTER(x) ((void *)(unsigned long)(x))
7+
#define SPOINTER_TO_INT(x) ((unsigned int)(unsigned long)(x))
8+
9+
#endif /* __S_TYPE_CONVERSAION_H__*/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /