qxLib
|
Go to the source code of this file.
Functions | |
template<class T > | |
constexpr T | qx::abs (T value) |
Constexpr absolute value. More... | |
template<class T > | |
constexpr bool | qx::epsilon_equal (T left, T right, T eps=std::numeric_limits< T >::epsilon()) |
Constexpr comparison function for a user defined epsilon values. More... | |
template<class T > | |
constexpr bool | qx::epsilon_zero (T value, T eps=std::numeric_limits< T >::epsilon()) |
Constexpr comparison with zero for a user defined epsilon values. More... | |
template<class T > | |
constexpr bool | qx::epsilon_less_equal (T left, T right, T eps=std::numeric_limits< T >::epsilon()) |
Constexpr comparison function for a user defined epsilon values. More... | |
template<class T > | |
constexpr bool | qx::epsilon_greater_equal (T left, T right, T eps=std::numeric_limits< T >::epsilon()) |
Constexpr comparison function for a user defined epsilon values. More... | |
template<std::integral T> | |
constexpr bool | qx::is_odd (T val) |
Check if value is odd. More... | |
template<std::integral T> | |
constexpr bool | qx::is_even (T val) |
Check if value is even. More... | |
constexpr int | qx::gcd (int nFirst, int nSecond) |
Greatest common divisor. More... | |
constexpr int | qx::lcm (int nFirst, int nSecond) |
Least common multiple. More... | |
template<class T > | |
double | qx::pow (T number, int nPower) |
Power function for integer power. More... | |
template<std::integral I> | |
I | qx::maxpot (I nValue) |
Max power of two in integer. More... | |
template<class T , class compare_t = std::less_equal<>> | |
constexpr bool | qx::between (T left, T value, T right, compare_t compare) |
Checks if value is between left and right. More... | |
template<class T , class compare_t = std::less_equal<>> | |
constexpr bool | qx::between (T left, T value, T right) |
Checks if value is between left and right. More... | |
|
constexpr |
Constexpr absolute value.
T | - value type |
value | - value |
- | absolute value |
Definition at line 14 of file common.inl.
|
constexpr |
Checks if value is between left and right.
Overloading for disabling 4388 warning with Compare instantiation
T | - value type |
compare_t | - comparator type |
left | - left value |
value | - value |
right | - right value |
- | true, left <= value <= right |
Definition at line 177 of file common.inl.
|
constexpr |
Checks if value is between left and right.
T | - value type |
compare_t | - comparator type |
left | - left value |
value | - value |
right | - right value |
compare | - comparator function |
- | true, left <= value <= right |
Definition at line 153 of file common.inl.
|
constexpr |
Constexpr comparison function for a user defined epsilon values.
T | - value type |
left | - left value |
right | - right value |
eps | - epsilon value |
- | true if |left - right| < eps |
Definition at line 20 of file common.inl.
|
constexpr |
Constexpr comparison function for a user defined epsilon values.
T | - value type |
left | - left value |
right | - right value |
eps | - epsilon value |
- | true if left > right or |left - right| < eps |
Definition at line 38 of file common.inl.
|
constexpr |
Constexpr comparison function for a user defined epsilon values.
T | - value type |
left | - left value |
right | - right value |
eps | - epsilon value |
- | true if left < right or |left - right| < eps |
Definition at line 32 of file common.inl.
|
constexpr |
Constexpr comparison with zero for a user defined epsilon values.
T | - value type |
value | - user value |
eps | - epsilon value |
- | true if |value| < eps |
Definition at line 26 of file common.inl.
|
constexpr |
Greatest common divisor.
Euclid's algorithm based on fact gcd(A, B) == gcd(B, A mod B)
nFirst | - first num |
nSecond | - second num |
- | greatest common divisor if first and second > 0, otherwise 0 |
Definition at line 55 of file common.inl.
|
constexpr |
Check if value is even.
T | - integral type |
val | - value |
- | true if value is even |
Definition at line 50 of file common.inl.
|
constexpr |
Check if value is odd.
T | - integral type |
val | - value |
- | true if value is odd |
Definition at line 44 of file common.inl.
|
constexpr |
Least common multiple.
nFirst | - first num |
nSecond | - second num |
- | least common multiple if first and second > 0, otherwise 0 |
Definition at line 70 of file common.inl.
|
inline |
Max power of two in integer.
I | - Integral type |
nValue | - number |
- | max power of two in number |
Definition at line 131 of file common.inl.
|
inline |
Power function for integer power.
About 2.22 times (positive powers) 1.7 times (positive and negative powers) 2.33 times (negative powers) faster then std::pow
T | - Integral or floating point type |
number | - integral of floating point value |
nPower | - integral power |
- | number ^ power |
Definition at line 82 of file common.inl.