Module malachite_base::num::logic::traits
source · Expand description
Various traits for performing logic or bitwise operations on numbers.
Traits§
- Defines functions that access or modify individual bits in a number.
- Defines functions that access or modify blocks of adjacent bits in a number.
- Defines functions that express a number as a
Vec
of bits or construct a number from an iterator of bits. - Defines an iterator over a value’s bits.
- Defines functions that search for the next
true
orfalse
bit in a number, starting at a specified index and searching in the more-significant direction. - Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.
- Returns the number of ones in the binary representation of a number.
- Returns the number of zeros in the binary representation of a number.
- Returns the Hamming distance between two numbers, or the number of bit flips needed to turn one into the other.
- Returns the number of leading zeros in the binary representation of a number.
- Returns a number whose least significant $b$ bits are
true
and whose other bits arefalse
. - Replaces a number with its bitwise negation.
- Returns the number of trailing zeros in the binary representation of a number.