Skip to content

Commit 99295c9

Browse files
authored
simplify and beautify portBYTE_ALIGNMENT (#309)
1 parent 05ded5b commit 99295c9

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

include/portable.h

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -53,29 +53,17 @@
5353

5454
#if portBYTE_ALIGNMENT == 32
5555
#define portBYTE_ALIGNMENT_MASK ( 0x001f )
56-
#endif
57-
58-
#if portBYTE_ALIGNMENT == 16
56+
#elif portBYTE_ALIGNMENT == 16
5957
#define portBYTE_ALIGNMENT_MASK ( 0x000f )
60-
#endif
61-
62-
#if portBYTE_ALIGNMENT == 8
58+
#elif portBYTE_ALIGNMENT == 8
6359
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
64-
#endif
65-
66-
#if portBYTE_ALIGNMENT == 4
60+
#elif portBYTE_ALIGNMENT == 4
6761
#define portBYTE_ALIGNMENT_MASK ( 0x0003 )
68-
#endif
69-
70-
#if portBYTE_ALIGNMENT == 2
62+
#elif portBYTE_ALIGNMENT == 2
7163
#define portBYTE_ALIGNMENT_MASK ( 0x0001 )
72-
#endif
73-
74-
#if portBYTE_ALIGNMENT == 1
64+
#elif portBYTE_ALIGNMENT == 1
7565
#define portBYTE_ALIGNMENT_MASK ( 0x0000 )
76-
#endif
77-
78-
#ifndef portBYTE_ALIGNMENT_MASK
66+
#else
7967
#error "Invalid portBYTE_ALIGNMENT definition"
8068
#endif
8169

0 commit comments

Comments
 (0)