mirror of
https://github.com/Xaymar/obs-StreamFX
synced 2024-11-11 06:15:05 +00:00
util-math: Functions to calculate nearest power of two values
This commit is contained in:
parent
d78d3024cc
commit
408481c22d
1 changed files with 8 additions and 0 deletions
|
@ -31,3 +31,11 @@ inline double_t Gaussian1D(double_t x, double_t o) {
|
||||||
double_t a = (1.0 / (o * PI2_SQROOT));
|
double_t a = (1.0 / (o * PI2_SQROOT));
|
||||||
return a * b;
|
return a * b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline size_t GetNearestPowerOfTwoAbove(size_t v) {
|
||||||
|
return 1 << size_t(ceil(log10(v) / log10(2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
inline size_t GetNearestPowerOfTwoBelow(size_t v) {
|
||||||
|
return 1 << size_t(floor(log10(v) / log10(2)));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue