Skip to content

Commit

Permalink
simplify and beautify portBYTE_ALIGNMENT (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
mysterywolf authored Apr 14, 2021
1 parent 05ded5b commit 99295c9
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions include/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,29 +53,17 @@

#if portBYTE_ALIGNMENT == 32
#define portBYTE_ALIGNMENT_MASK ( 0x001f )
#endif

#if portBYTE_ALIGNMENT == 16
#elif portBYTE_ALIGNMENT == 16
#define portBYTE_ALIGNMENT_MASK ( 0x000f )
#endif

#if portBYTE_ALIGNMENT == 8
#elif portBYTE_ALIGNMENT == 8
#define portBYTE_ALIGNMENT_MASK ( 0x0007 )
#endif

#if portBYTE_ALIGNMENT == 4
#elif portBYTE_ALIGNMENT == 4
#define portBYTE_ALIGNMENT_MASK ( 0x0003 )
#endif

#if portBYTE_ALIGNMENT == 2
#elif portBYTE_ALIGNMENT == 2
#define portBYTE_ALIGNMENT_MASK ( 0x0001 )
#endif

#if portBYTE_ALIGNMENT == 1
#elif portBYTE_ALIGNMENT == 1
#define portBYTE_ALIGNMENT_MASK ( 0x0000 )
#endif

#ifndef portBYTE_ALIGNMENT_MASK
#else
#error "Invalid portBYTE_ALIGNMENT definition"
#endif

Expand Down

0 comments on commit 99295c9

Please sign in to comment.