projects
/
linux.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f97fa3d
)
lib/math/int_log: Use ARRAY_SIZE(logtable) where makes sense
author
Andy Shevchenko
<andriy.shevchenko@linux.intel.com>
Mon, 3 Jul 2023 13:52:09 +0000
(16:52 +0300)
committer
Mark Brown
<broonie@kernel.org>
Sun, 9 Jul 2023 21:47:49 +0000
(22:47 +0100)
Use ARRAY_SIZE(logtable) where makes sense.
Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Link:
https://lore.kernel.org/r/20230619172019.21457-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link:
https://lore.kernel.org/r/20230703135211.87416-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
lib/math/int_log.c
patch
|
blob
|
history
diff --git
a/lib/math/int_log.c
b/lib/math/int_log.c
index 322df25a22d6ab0df92ff256de5149ed7120e1ea..ea98fc0b3fe247c6bade9b2965e02761a695e9db 100644
(file)
--- a/
lib/math/int_log.c
+++ b/
lib/math/int_log.c
@@
-91,7
+91,7
@@
unsigned int intlog2(u32 value)
* so we would use the entry 0x18
*/
significand = value << (31 - msb);
- logentry = (significand >> 23)
& 0xff
;
+ logentry = (significand >> 23)
% ARRAY_SIZE(logtable)
;
/**
* last step we do is interpolation because of the
@@
-109,7
+109,7
@@
unsigned int intlog2(u32 value)
* logtable_next is 256
*/
interpolation = ((significand & 0x7fffff) *
- ((logtable[(logentry + 1)
& 0xff
] -
+ ((logtable[(logentry + 1)
% ARRAY_SIZE(logtable)
] -
logtable[logentry]) & 0xffff)) >> 15;
/* now we return the result */