This library provides useful tools for bit tricks with solidity and gas-efficient data sturctures powered by these bit tricks.
- BitScan: Powered by de Bruijn sequence, this library provides gas efficient functions to find the index of the least and most significant set bits. It can also be used for efficiently calculating the log2 of a value.
- Popcount: Calculate the number of 1 bits of an unsigned integer.
- BitMaps: A modified Openzeppelin's BitMaps library with additional functions to efficiently find the closest set bit.
npm install --save-dev solidity-bits
yarn add --dev solidity-bits