Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
2016 001 Add popCount to WORD signature
Clone this wiki locally
Add popCount to WORD signature
Author: John Reppy
Last revised: May 9, 2016
Discussion: issue #13
This proposal adds the population-count operation to the
val popCount : word -> int
returns the number of `1` bits in the word `w`.
This operation is useful for computing the Hamming distance between two words and for implementing various data structures (e.g., the Hash array mapped trie). There are two reasons for making it part of the Basis Library:
the straight-line implementation depends on the size of the word type.
some architectures support the operation in hardware, which can be even faster than the the straight-line code.