Skip to content

Commit

Permalink
Undoing formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lemire committed Feb 14, 2014
1 parent 2627f20 commit 15635d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions bitset.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ const h01 uint64 = 0x0101010101010101 //the sum of 256 to the power of 0,1,2,3..
// This is algorithm popcount_2 in the article retrieved May 9, 2011

func popcount_2(x uint64) uint64 {
x -= (x >> 1) & m1 //put count of each 2 bits into those 2 bits
x -= (x >> 1) & m1 //put count of each 2 bits into those 2 bits
x = (x & m2) + ((x >> 2) & m2) //put count of each 4 bits into those 4 bits
x = (x + (x >> 4)) & m4 //put count of each 8 bits into those 8 bits
x += x >> 8 //put count of each 16 bits into their lowest 8 bits
x += x >> 16 //put count of each 32 bits into their lowest 8 bits
x += x >> 32 //put count of each 64 bits into their lowest 8 bits
x = (x + (x >> 4)) & m4 //put count of each 8 bits into those 8 bits
x += x >> 8 //put count of each 16 bits into their lowest 8 bits
x += x >> 16 //put count of each 32 bits into their lowest 8 bits
x += x >> 32 //put count of each 64 bits into their lowest 8 bits
return x & 0x7f
}

Expand Down

0 comments on commit 15635d3

Please sign in to comment.