Minor improvement to the default get_msb function
Use `shift` as the loop index variable.
This algorithm is essentially Figure 5-13 in Hacker's Delight.
Change-Id: I4d6bf7160371c0dce7cf76f1d9fe24e2733d78c9
diff --git a/aom_ports/bitops.h b/aom_ports/bitops.h
index 9309dad..3c5b992 100644
--- a/aom_ports/bitops.h
+++ b/aom_ports/bitops.h
@@ -70,12 +70,10 @@
static INLINE int get_msb(unsigned int n) {
int log = 0;
unsigned int value = n;
- int i;
assert(n != 0);
- for (i = 4; i >= 0; --i) {
- const int shift = (1 << i);
+ for (int shift = 16; shift != 0; shift >>= 1) {
const unsigned int x = value >> shift;
if (x != 0) {
value = x;