py/misc: Fix fallback implementation of mp_popcount.
Tested using gcc 7.3.1 which does not have the popcount built-in and uses this fallback version. Without the fix, mpy-cross produces mpy files with corrupt RISC-V machine code. With the fix, mpy-cross output is correct. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
e57aa7e70a
commit
6fee099cae
1 changed files with 1 additions and 1 deletions
|
|
@ -390,7 +390,7 @@ static inline uint32_t mp_popcount(uint32_t x) {
|
|||
x = x - ((x >> 1) & 0x55555555);
|
||||
x = (x & 0x33333333) + ((x >> 2) & 0x33333333);
|
||||
x = (x + (x >> 4)) & 0x0F0F0F0F;
|
||||
return x * 0x01010101;
|
||||
return (x * 0x01010101) >> 24;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue