From 0645f91289857c914e29eae63f45e7795aefb0fe Mon Sep 17 00:00:00 2001 From: Jonathan Young Date: Mon, 15 May 2017 02:28:37 +1000 Subject: [PATCH] Fix bx::flog2 giving incorrect result when compiled to asm.js. (#150) --- include/bx/inline/fpumath.inl | 5 ----- src/fpumath.cpp | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/bx/inline/fpumath.inl b/include/bx/inline/fpumath.inl index e87b827..e2959a1 100644 --- a/include/bx/inline/fpumath.inl +++ b/include/bx/inline/fpumath.inl @@ -136,11 +136,6 @@ namespace bx return fpow(2.0f, _a); } - inline float flog2(float _a) - { - return flog(_a) * 1.442695041f; - } - inline float frsqrt(float _a) { return 1.0f/fsqrt(_a); diff --git a/src/fpumath.cpp b/src/fpumath.cpp index e957ef9..c85ccc2 100644 --- a/src/fpumath.cpp +++ b/src/fpumath.cpp @@ -63,6 +63,11 @@ namespace bx return ::logf(_a); } + float flog2(float _a) + { + return ::logf(_a) * (1 / ::logf(2)); + } + float fsqrt(float _a) { return ::sqrtf(_a);