mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 01:55:46 +01:00
Use builtin CLZ
Signed-off-by: Kevin Bracey <kevin.bracey@arm.com>
This commit is contained in:
parent
3be252e252
commit
99c64e142e
@ -424,9 +424,13 @@ bitcount_t uECC_vli_numBits(const uECC_word_t *vli)
|
|||||||
}
|
}
|
||||||
|
|
||||||
digit = vli[num_digits - 1];
|
digit = vli[num_digits - 1];
|
||||||
|
#if defined __GNUC__ || defined __clang__ || defined __CC_ARM
|
||||||
|
i = uECC_WORD_BITS - __builtin_clz(digit);
|
||||||
|
#else
|
||||||
for (i = 0; digit; ++i) {
|
for (i = 0; digit; ++i) {
|
||||||
digit >>= 1;
|
digit >>= 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return (((bitcount_t)(num_digits - 1) << uECC_WORD_BITS_SHIFT) + i);
|
return (((bitcount_t)(num_digits - 1) << uECC_WORD_BITS_SHIFT) + i);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user