Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
ph::math Namespace Reference

Functions

template<typename T >
constexpr bool is_power_of_2 (const T value)
 Determines whether value is a power-of-2 number.
 
template<std::size_t BASE, typename T >
constexpr bool is_power_of (const T value)
 Determines whether value is a power-of-BASE number. Checks the equality BASE^n == value, where n is an integer.
 
template<std::integral T>
ceil_div (const T numerator, const T denominator)
 Divide numerator by denominator and round up to integer. Both inputs must be positive integer. Specifically, numerator >= 0 and denominator > 0.
 
template<std::integral T>
next_multiple (const T value, const T multiple)
 Get the next number that is an integer multiple of multiple. Specifically, get the minimum number x = C * multiple >= value where C is an integer >= 0. Currently supports positive integers only.
 
template<std::integral T>
next_power_of_2_multiple (const T value, const T multiple)
 Same as next_multiple(T, T) except that multiple must be a power of 2 number.
 

Function Documentation

◆ ceil_div()

template<std::integral T>
T ph::math::ceil_div ( const T numerator,
const T denominator )
inline

Divide numerator by denominator and round up to integer. Both inputs must be positive integer. Specifically, numerator >= 0 and denominator > 0.

◆ is_power_of()

template<std::size_t BASE, typename T >
bool ph::math::is_power_of ( const T value)
inlineconstexpr

Determines whether value is a power-of-BASE number. Checks the equality BASE^n == value, where n is an integer.

◆ is_power_of_2()

template<typename T >
bool ph::math::is_power_of_2 ( const T value)
inlineconstexpr

Determines whether value is a power-of-2 number.

◆ next_multiple()

template<std::integral T>
T ph::math::next_multiple ( const T value,
const T multiple )
inline

Get the next number that is an integer multiple of multiple. Specifically, get the minimum number x = C * multiple >= value where C is an integer >= 0. Currently supports positive integers only.

◆ next_power_of_2_multiple()

template<std::integral T>
T ph::math::next_power_of_2_multiple ( const T value,
const T multiple )
inline

Same as next_multiple(T, T) except that multiple must be a power of 2 number.