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

Oliver O'Halloran oohall at gmail.com
Wed Nov 8 19:59:16 AEDT 2017

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 at gmail.com>
 libflash/ecc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-	return __builtin_parityl(data);
+	return __builtin_parityll(data);

More information about the Skiboot mailing list