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

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

Commit Message

Oliver Nov. 8, 2017, 8:59 a.m.
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 --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);