Skip to content

Commit

Permalink
GET16 using structs
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph Mattello <[email protected]>
  • Loading branch information
JoeMatt committed Oct 14, 2021
1 parent 42fd367 commit 90505b6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/vjag_memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,18 @@ extern const char * whoName[10];
r[(a)+2] = ((v) & 0x0000FF00) >> 8, r[(a)+3] = (v) & 0x000000FF
#define GET32(r, a) ((r[(a)] << 24) | (r[(a)+1] << 16) | (r[(a)+2] << 8) | r[(a)+3])
#define SET16(r, a, v) r[(a)] = ((v) & 0xFF00) >> 8, r[(a)+1] = (v) & 0xFF
#define GET16(r, a) ((r[(a)] << 8) | r[(a)+1])


#ifdef USE_STRUCTS
INLINE static uint16_t GET16(uint8_t* r,uint32_t a) {
U16Union u16;
u16.Bytes.UBYTE = r[a];
u16.Bytes.LBYTE = r[a+1];
return u16.WORD;
}
#else
#define GET16(r, a) ((r[(a)] << 8) | r[(a)+1])
#endif

#ifdef __cplusplus
}
Expand Down

0 comments on commit 90505b6

Please sign in to comment.