Skip to content

Commit 9e02040

Browse files
committed
happy linter
1 parent 787d5a3 commit 9e02040

File tree

1 file changed

+44
-64
lines changed

1 file changed

+44
-64
lines changed

include/third_party/incbin.h

Lines changed: 44 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,20 @@
99
#ifndef INCBIN_HDR
1010
#define INCBIN_HDR
1111
#include <limits.h>
12-
#if defined(__AVX512BW__) || \
13-
defined(__AVX512CD__) || \
14-
defined(__AVX512DQ__) || \
15-
defined(__AVX512ER__) || \
16-
defined(__AVX512PF__) || \
17-
defined(__AVX512VL__) || \
18-
defined(__AVX512F__)
19-
# define INCBIN_ALIGNMENT_INDEX 6
20-
#elif defined(__AVX__) || \
21-
defined(__AVX2__)
22-
# define INCBIN_ALIGNMENT_INDEX 5
23-
#elif defined(__SSE__) || \
24-
defined(__SSE2__) || \
25-
defined(__SSE3__) || \
26-
defined(__SSSE3__) || \
27-
defined(__SSE4_1__) || \
28-
defined(__SSE4_2__) || \
29-
defined(__neon__) || \
30-
defined(__ARM_NEON) || \
31-
defined(__ALTIVEC__)
32-
# define INCBIN_ALIGNMENT_INDEX 4
12+
#if defined(__AVX512BW__) || defined(__AVX512CD__) || defined(__AVX512DQ__) || \
13+
defined(__AVX512ER__) || defined(__AVX512PF__) || defined(__AVX512VL__) || \
14+
defined(__AVX512F__)
15+
#define INCBIN_ALIGNMENT_INDEX 6
16+
#elif defined(__AVX__) || defined(__AVX2__)
17+
#define INCBIN_ALIGNMENT_INDEX 5
18+
#elif defined(__SSE__) || defined(__SSE2__) || defined(__SSE3__) || defined(__SSSE3__) || \
19+
defined(__SSE4_1__) || defined(__SSE4_2__) || defined(__neon__) || defined(__ARM_NEON) || \
20+
defined(__ALTIVEC__)
21+
#define INCBIN_ALIGNMENT_INDEX 4
3322
#elif ULONG_MAX != 0xffffffffu
34-
# define INCBIN_ALIGNMENT_INDEX 3
35-
# else
36-
# define INCBIN_ALIGNMENT_INDEX 2
23+
#define INCBIN_ALIGNMENT_INDEX 3
24+
#else
25+
#define INCBIN_ALIGNMENT_INDEX 2
3726
#endif
3827

3928
/* Lookup table of (1 << n) where `n' is `INCBIN_ALIGNMENT_INDEX' */
@@ -46,79 +35,70 @@
4635
#define INCBIN_ALIGN_SHIFT_6 64
4736

4837
/* Actual alignment value */
49-
#define INCBIN_ALIGNMENT \
50-
INCBIN_CONCATENATE( \
51-
INCBIN_CONCATENATE(INCBIN_ALIGN_SHIFT, _), \
52-
INCBIN_ALIGNMENT_INDEX)
38+
#define INCBIN_ALIGNMENT \
39+
INCBIN_CONCATENATE(INCBIN_CONCATENATE(INCBIN_ALIGN_SHIFT, _), INCBIN_ALIGNMENT_INDEX)
5340

5441
/* Stringize */
55-
#define INCBIN_STR(X) \
56-
#X
57-
#define INCBIN_STRINGIZE(X) \
58-
INCBIN_STR(X)
42+
#define INCBIN_STR(X) #X
43+
#define INCBIN_STRINGIZE(X) INCBIN_STR(X)
5944
/* Concatenate */
60-
#define INCBIN_CAT(X, Y) \
61-
X ## Y
62-
#define INCBIN_CONCATENATE(X, Y) \
63-
INCBIN_CAT(X, Y)
45+
#define INCBIN_CAT(X, Y) X##Y
46+
#define INCBIN_CONCATENATE(X, Y) INCBIN_CAT(X, Y)
6447
/* Deferred macro expansion */
65-
#define INCBIN_EVAL(X) \
66-
X
67-
#define INCBIN_INVOKE(N, ...) \
68-
INCBIN_EVAL(N(__VA_ARGS__))
48+
#define INCBIN_EVAL(X) X
49+
#define INCBIN_INVOKE(N, ...) INCBIN_EVAL(N(__VA_ARGS__))
6950
/* Variable argument count for overloading by arity */
7051
#define INCBIN_VA_ARG_COUNTER(_1, _2, _3, N, ...) N
7152
#define INCBIN_VA_ARGC(...) INCBIN_VA_ARG_COUNTER(__VA_ARGS__, 3, 2, 1, 0)
7253

7354
/* Green Hills uses a different directive for including binary data */
7455
#if defined(__ghs__)
75-
# if (__ghs_asm == 2)
76-
# define INCBIN_MACRO ".file"
56+
#if (__ghs_asm == 2)
57+
#define INCBIN_MACRO ".file"
7758
/* Or consider the ".myrawdata" entry in the ld file */
78-
# else
79-
# define INCBIN_MACRO "\tINCBIN"
80-
# endif
8159
#else
82-
# define INCBIN_MACRO ".incbin"
60+
#define INCBIN_MACRO "\tINCBIN"
61+
#endif
62+
#else
63+
#define INCBIN_MACRO ".incbin"
8364
#endif
8465

8566
#ifndef _WIN32
86-
# define INCBIN_ALIGN \
87-
__attribute__((aligned(INCBIN_ALIGNMENT)))
67+
#define INCBIN_ALIGN __attribute__((aligned(INCBIN_ALIGNMENT)))
8868
#else
89-
# define INCBIN_ALIGN __declspec(align(INCBIN_ALIGNMENT))
69+
#define INCBIN_ALIGN __declspec(align(INCBIN_ALIGNMENT))
9070
#endif
9171

92-
#if defined(__arm__) || /* GNU C and RealView */ \
93-
defined(__arm) || /* Diab */ \
94-
defined(_ARM) /* ImageCraft */
95-
# define INCBIN_ARM
72+
#if defined(__arm__) || /* GNU C and RealView */ \
73+
defined(__arm) || /* Diab */ \
74+
defined(_ARM) /* ImageCraft */
75+
#define INCBIN_ARM
9676
#endif
9777

9878
#ifdef __GNUC__
9979
/* Utilize .balign where supported */
100-
# define INCBIN_ALIGN_HOST ".balign " INCBIN_STRINGIZE(INCBIN_ALIGNMENT) "\n"
101-
# define INCBIN_ALIGN_BYTE ".balign 1\n"
80+
#define INCBIN_ALIGN_HOST ".balign " INCBIN_STRINGIZE(INCBIN_ALIGNMENT) "\n"
81+
#define INCBIN_ALIGN_BYTE ".balign 1\n"
10282
#elif defined(INCBIN_ARM)
10383
/*
10484
* On arm assemblers, the alignment value is calculated as (1 << n) where `n' is
10585
* the shift count. This is the value passed to `.align'
10686
*/
107-
# define INCBIN_ALIGN_HOST ".align " INCBIN_STRINGIZE(INCBIN_ALIGNMENT_INDEX) "\n"
108-
# define INCBIN_ALIGN_BYTE ".align 0\n"
87+
#define INCBIN_ALIGN_HOST ".align " INCBIN_STRINGIZE(INCBIN_ALIGNMENT_INDEX) "\n"
88+
#define INCBIN_ALIGN_BYTE ".align 0\n"
10989
#else
11090
/* We assume other inline assembler's treat `.align' as `.balign' */
111-
# define INCBIN_ALIGN_HOST ".align " INCBIN_STRINGIZE(INCBIN_ALIGNMENT) "\n"
112-
# define INCBIN_ALIGN_BYTE ".align 1\n"
91+
#define INCBIN_ALIGN_HOST ".align " INCBIN_STRINGIZE(INCBIN_ALIGNMENT) "\n"
92+
#define INCBIN_ALIGN_BYTE ".align 1\n"
11393
#endif
11494

11595
/* INCBIN_CONST is used by incbin.c generated files */
11696
#if defined(__cplusplus)
117-
# define INCBIN_EXTERNAL extern "C"
118-
# define INCBIN_CONST extern const
97+
#define INCBIN_EXTERNAL extern "C"
98+
#define INCBIN_CONST extern const
11999
#else
120-
# define INCBIN_EXTERNAL extern
121-
# define INCBIN_CONST const
100+
#define INCBIN_EXTERNAL extern
101+
#define INCBIN_CONST const
122102
#endif
123103

124104
/**
@@ -473,4 +453,4 @@
473453
INCBIN_COMMON(char, NAME, FILENAME, INCBIN_BYTE "0\n")
474454
#endif
475455

476-
#endif
456+
#endif

0 commit comments

Comments
 (0)