generated from bing/readnotes
14 lines
250 B
C
14 lines
250 B
C
|
#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
|