matos/core/math.c
Mathieu Maret 3b97d0307d Style: harmonize formatting
Thanks to: "clang-format -i -style=file **/*.{c,h}"
2020-04-27 00:14:51 +02:00

10 lines
169 B
C

#include "math.h"
inline uint32_t log2(const uint32_t x)
{
uint32_t y;
// Get the highest set bit
asm("\tbsr %1, %0\n" : "=r"(y) : "r"(x));
return y;
}