diff mbox series

[11/13] libflash: Fix parity calculation on ARM

Message ID 20171108085918.12590-12-oohall@gmail.com
State Accepted
Headers show
Series [01/13] gard: show: Remove "Res Recovery" field | expand

Commit Message

Oliver O'Halloran Nov. 8, 2017, 8:59 a.m. UTC
To calculate the ECC syndrome we need to calculate the parity of a 64bit
number. On non-powerpc platforms we use the gcc builtin function
__builtin_parityl() to do this calculation. This is broken on 32bit ARM
where sizeof(unsigned long) is four bytes. Using __builtin_parityll()
instead cures this.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 libflash/ecc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libflash/ecc.c b/libflash/ecc.c
index 0be80b1f7a2e..0fbd30b92d00 100644
--- a/libflash/ecc.c
+++ b/libflash/ecc.c
@@ -121,7 +121,7 @@  static uint8_t parity(uint64_t data)
 
 	return p;
 #else
-	return __builtin_parityl(data);
+	return __builtin_parityll(data);
 #endif
 }