LibCtPop

Git Source

Functions

ctpop

Optimised version of ctpop. https://en.wikipedia.org/wiki/Hamming_weight

function ctpop(uint256 x) internal pure returns (uint256);

ctpopSlow

This is the slowest possible implementation of ctpop. It is used to verify the correctness of the optimized implementation in LibCtPop. It should be obviously correct by visual inspection, referencing the wikipedia article. https://en.wikipedia.org/wiki/Hamming_weight

function ctpopSlow(uint256 x) internal pure returns (uint256);