libpayload: Add more parenthesis to the endian conversion macros

There weren't enough parenthesis in the macros so operations might only apply
to the last part of an expression passed in as an argument.

Change-Id: I5afb406f9409986e45bbbc598bcbd0dd8507ed35
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2665
Tested-by: build bot (Jenkins)
Reviewed-by: Marc Jones <marc.jones@se-eng.com>
This commit is contained in:
Gabe Black 2013-01-31 04:27:39 -08:00 committed by Stefan Reinauer
commit 2def2625e0

View file

@ -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))))