blog/cpp/fonts/ft_math/ft_math.h

14 lines
250 B
C
Raw Normal View History

2024-09-13 15:10:58 +08:00
#ifndef __FONT_MATH_H__
#define __FONT_MATH_H__
#include <cstdint>
uint16_t highestBitValue(uint16_t x) {
if (x == 0) return 0;
uint16_t n = 0;
while (x > 1) {
x >>= 1;
n++;
}
return 1U << n;
}
#endif