Skip to content

Commit

Permalink
Merge pull request nasa#2119 from skliper/fix2118-endian_mask
Browse files Browse the repository at this point in the history
Fix nasa#2118, Endian macro mask before shift to avoid shift overflow warning
  • Loading branch information
astrogeco committed Jun 19, 2022
2 parents e48d7ed + 0286b6e commit 68931c6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/core_api/fsw/inc/cfe_endian.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
#define CFE_MAKE_BIG16(n) (n)
#define CFE_MAKE_BIG32(n) (n)
#else
#define CFE_MAKE_BIG16(n) ((((n) << 8) & 0xFF00) | (((n) >> 8) & 0x00FF))
#define CFE_MAKE_BIG16(n) ((((n)&0x00FF) << 8) | (((n)&0xFF00) >> 8))
#define CFE_MAKE_BIG32(n) \
((((n) << 24) & 0xFF000000) | (((n) << 8) & 0x00FF0000) | (((n) >> 8) & 0x0000FF00) | (((n) >> 24) & 0x000000FF))
((((n)&0x000000FF) << 24) | (((n)&0x0000FF00) << 8) | (((n)&0x00FF0000) >> 8) | (((n)&0xFF000000) >> 24))
#endif

#endif /* CFE_ENDIAN_H */

0 comments on commit 68931c6

Please sign in to comment.