fast_log2: silence unused variable warning.

This commit is contained in:
Ion Gaztañaga
2021-03-14 08:15:33 +01:00
parent 45d6e4ee18
commit c03b16b269

View File

@@ -209,13 +209,12 @@ namespace detail {
//http://www.flipcode.com/archives/Fast_log_Function.shtml
inline float fast_log2 (float val)
{
float f = val;
unsigned x;
std::memcpy(&x, &val, sizeof(f));
std::memcpy(&x, &val, sizeof(float));
const int log_2 = int((x >> 23) & 255) - 128;
x &= ~(unsigned(255u) << 23u);
x += unsigned(127) << 23u;
std::memcpy(&val, &x, sizeof(f));
std::memcpy(&val, &x, sizeof(float));
//1+log2(m), m ranging from 1 to 2
//3rd degree polynomial keeping first derivate continuity.
//For less precision the line can be commented out