Commit 08f6a14b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Mark Brown
parent f97fa3dc
...@@ -91,7 +91,7 @@ unsigned int intlog2(u32 value) ...@@ -91,7 +91,7 @@ unsigned int intlog2(u32 value)
* so we would use the entry 0x18 * so we would use the entry 0x18
*/ */
significand = value << (31 - msb); significand = value << (31 - msb);
logentry = (significand >> 23) & 0xff; logentry = (significand >> 23) % ARRAY_SIZE(logtable);
/** /**
* last step we do is interpolation because of the * last step we do is interpolation because of the
...@@ -109,7 +109,7 @@ unsigned int intlog2(u32 value) ...@@ -109,7 +109,7 @@ unsigned int intlog2(u32 value)
* logtable_next is 256 * logtable_next is 256
*/ */
interpolation = ((significand & 0x7fffff) * interpolation = ((significand & 0x7fffff) *
((logtable[(logentry + 1) & 0xff] - ((logtable[(logentry + 1) % ARRAY_SIZE(logtable)] -
logtable[logentry]) & 0xffff)) >> 15; logtable[logentry]) & 0xffff)) >> 15;
/* now we return the result */ /* now we return the result */
......
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