From 63016196ce3b1fb993d3d888a0bca9ea92348d36 Mon Sep 17 00:00:00 2001 From: Vladislav Belov Date: Mon, 21 Sep 2026 00:47:17 +0200 Subject: [PATCH] Removes unused code from lib/bits.h --- source/lib/bits.h | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/source/lib/bits.h b/source/lib/bits.h index 8c2ad06c6d..758c6c7c08 100644 --- a/source/lib/bits.h +++ b/source/lib/bits.h @@ -112,37 +112,6 @@ inline T bits(T num, size_t lo_idx, size_t hi_idx) return result; } -/** - * set the value of bits hi_idx:lo_idx - * - * @param lo_idx bit index of lowest bit to include - * @param hi_idx bit index of highest bit to include - * @param value new value to be assigned to these bits - **/ -template -inline T SetBitsTo(T num, size_t lo_idx, size_t hi_idx, size_t value) -{ - const size_t numBits = (hi_idx - lo_idx)+1; - ASSERT(value < (T(1) << numBits)); - const T mask = bit_mask(numBits) << lo_idx; - T result = num & ~mask; - result = T(result | (value << lo_idx)); - return result; -} - -template -inline T LeastSignificantBit(T x) -{ - const T negX = T(~x + 1); // 2's complement (avoids 'negating unsigned type' warning) - return x & negX; -} - -template -inline T ClearLeastSignificantBit(T x) -{ - return x & (x-1); -} - /** * round number up/down to the next given multiple. * @@ -173,20 +142,4 @@ inline T round_down(T n, T multiple) // for constant static data members. #define ROUND_UP(n, multiple) (((n) + (multiple)-1) & ~((multiple)-1)) - -template -inline T MaxPowerOfTwoDivisor(T value) -{ - ASSERT(value != T(0)); - - for(size_t log2 = 0; log2 < sizeof(T)*CHAR_BIT; log2++) - { - if(IsBitSet(value, log2)) - return T(1) << log2; - } - - DEBUG_WARN_ERR(ERR::LOGIC); // unreachable (!= 0 => there is a set bit) - return 0; -} - #endif // #ifndef INCLUDED_BITS