fp: Change FPUnpacked to a normalized representation

Having a known position for the highest set bit makes writing algorithms easier
This commit is contained in:
MerryMage 2018-07-25 17:39:14 +01:00
parent 680395a803
commit 7a673a8a43
10 changed files with 71 additions and 56 deletions

View file

@ -150,7 +150,7 @@ inline size_t BitCount(Integral value) {
}
template <typename T>
inline int HighestSetBit(T value) {
constexpr int HighestSetBit(T value) {
auto x = static_cast<std::make_unsigned_t<T>>(value);
int result = -1;
while (x != 0) {