Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
improved count atoms
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Kliem committed Aug 25, 2020
1 parent 39f3a38 commit bf91483
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ inline size_t count_atoms(uint64_t* A, size_t face_length){
This is the number of set bits in A.
``face_length`` is the length of A in terms of uint64_t.
*/
size_t i;
unsigned int count = 0;
for (size_t i=0; i<face_length; i++){
for (i=0; i<face_length; i++){
uint64_t a = A[i];
while (a){
count += a & 1;
a >>= 1;
}
a = a - ((a >> 1) & 0x5555555555555555ULL);
a = (a & 0x3333333333333333ULL) + ((a >> 2) & 0x3333333333333333ULL);
count += ( ((a + (a >> 4)) & 0x0f0f0f0f0f0f0f0fULL) * 0x0101010101010101ULL ) >> 56;
}
return count;
}
Expand Down

0 comments on commit bf91483

Please sign in to comment.