Skip to content

Commit

Permalink
Fix ARM SVE code
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jun 26, 2024
1 parent b6c6c20 commit baeb7ac
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libpopcnt.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,12 +673,13 @@ static inline uint64_t popcnt(const void* data, uint64_t size)
while (svptest_any(svptrue_b64(), pg));

uint64_t cnt = svaddv_u64(svptrue_b64(), vcnt);
size %= sizeof(uint64_t);
uint64_t rem = size % sizeof(uint64_t);

if (size > 0)
if (rem != 0)
{
uint64_t val = 0;
memcpy(&val, &ptr64[i], size);
const uint8_t* ptr8 = (const uint8_t*) data;
memcpy(&val, &ptr8[size - rem], rem);
cnt += popcnt64(val);
}

Expand Down

0 comments on commit baeb7ac

Please sign in to comment.