diff options
-rw-r--r-- | payloads/libpayload/include/endian.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/payloads/libpayload/include/endian.h b/payloads/libpayload/include/endian.h index 941dd1012f..ee9cf136a0 100644 --- a/payloads/libpayload/include/endian.h +++ b/payloads/libpayload/include/endian.h @@ -26,9 +26,10 @@ #include <arch/types.h> #include <libpayload-config.h> -#define swap_bytes16(in) (((in & 0xFF) << 8) | ((in & 0xFF00) >> 8)) -#define swap_bytes32(in) (((in & 0xFF) << 24) | ((in & 0xFF00) << 8) | \ - ((in & 0xFF0000) >> 8) | ((in & 0xFF000000) >> 24)) +#define swap_bytes16(in) ((((in) & 0xFF) << 8) | (((in) & 0xFF00) >> 8)) +#define swap_bytes32(in) ((((in) & 0xFF) << 24) | (((in) & 0xFF00) << 8) | \ + (((in) & 0xFF0000) >> 8) | \ + (((in) & 0xFF000000) >> 24)) #define swap_bytes64(in) (((uint64_t)swap_bytes32((uint32_t)(in)) << 32) | \ ((uint64_t)swap_bytes32((uint32_t)((in) >> 32)))) |