|
ape
0.5.0
Audio Programming Environment
|
Go to the documentation of this file. 1 #ifndef CPPAPE_MATHUTIL_H
2 #define CPPAPE_MATHUTIL_H
15 inline std::size_t
clamp_available(std::size_t position, std::size_t size, std::size_t available)
17 return std::min(available, size - position);
45 template<
typename UIntType>
46 inline typename std::enable_if<std::is_unsigned<UIntType>::value,
bool>::type
ispow2(UIntType t)
48 return (t & (t - 1)) == 0;
Definition: audiofile.h:7
size_t nextpow2above(size_t current)
Returns the next power of two, above current
Definition: mathutil.h:34
std::enable_if< std::is_unsigned< UIntType >::value, bool >::type ispow2(UIntType t)
Tests whether t is a power of two.
Definition: mathutil.h:46
std::size_t clamp_available(std::size_t position, std::size_t size, std::size_t available)
Step N towards size given available "samples", if at position sample. This is a useful utility to ...
Definition: mathutil.h:15
size_t nextpow2(size_t current)
Returns the next power of two, or equivalent to current
Definition: mathutil.h:23