add stasis_round_up_to_power_of_two
This commit is contained in:
parent
b3e5743691
commit
ecbdc9513f
1 changed files with 8 additions and 0 deletions
|
@ -52,4 +52,12 @@ static inline uint8_t stasis_log_2_64(uint64_t v) {
|
|||
return r;
|
||||
}
|
||||
|
||||
static inline uint64_t stasis_round_up_to_power_of_two(uint64_t v) {
|
||||
if(v) {
|
||||
return 1 << (stasis_log_2_64(v)-1);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* LOG2_H_ */
|
||||
|
|
Loading…
Reference in a new issue