OpenTTD
|
Functions related to bit mathematics. More...
Go to the source code of this file.
Functions | |
uint8 | FindFirstBit (uint32 x) |
Search the first set bit in a 32 bit variable. | |
uint8 | FindLastBit (uint64 x) |
Search the last set bit in a 64 bit variable. |
Variables | |
const uint8 | _ffb_64 [64] |
Lookup table to check which bit is set in a 6 bit variable. |
Functions related to bit mathematics.
Definition in file bitmath_func.cpp.
uint8 FindFirstBit | ( | uint32 | x | ) |
Search the first set bit in a 32 bit variable.
This algorithm is a static implementation of a log congruence search algorithm. It checks the first half if there is a bit set search there further. And this way further. If no bit is set return 0.
x | The value to search |
Definition at line 39 of file bitmath_func.cpp.
Referenced by AllocateMap(), CalculateRefitMasks(), and ExploreSegment().
uint8 FindLastBit | ( | uint64 | x | ) |
Search the last set bit in a 64 bit variable.
This algorithm is a static implementation of a log congruence search algorithm. It checks the second half if there is a bit set search there further. And this way further. If no bit is set return 0.
x | The value to search |
Definition at line 67 of file bitmath_func.cpp.
Referenced by BaseGraphWindow::DrawGraph().
const uint8 _ffb_64[64] |
Lookup table to check which bit is set in a 6 bit variable.
Definition at line 17 of file bitmath_func.cpp.