Stefan Reinauer ([email protected]) just uploaded a new patch set to 
gerrit, which you can find at http://review.coreboot.org/2665

-gerrit

commit 6ade5f7e9c505ae959aec851b184a0e8ef02ba59
Author: Gabe Black <[email protected]>
Date:   Thu Jan 31 04:27:39 2013 -0800

    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 <[email protected]>
---
 payloads/libpayload/include/endian.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/payloads/libpayload/include/endian.h 
b/payloads/libpayload/include/endian.h
index cd805e0..42237ea 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))))
 

-- 
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to