Commit e206543e by Nicolas Capens

Fix log2() accuracy.

Bug 28474248 Change-Id: I61bf28687623437c6b9b383dc189ffa28ad24c22 Reviewed-on: https://swiftshader-review.googlesource.com/5330Tested-by: 's avatarNicolas Capens <capn@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent a0600301
......@@ -158,9 +158,7 @@ namespace sw
inline float log2(float x)
{
unsigned int y = (*(unsigned int*)&x);
return (float)((y & 0x7F800000) >> 23) - 127 + (float)((*(unsigned int*)&x) & 0x007FFFFF) / 16777216.0f;
return logf(x) * 1.44269504f; // 1.0 / log[e](2)
}
inline bool isPow2(int x)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment