|
|
|
@ -30,39 +30,4 @@ namespace detail |
|
|
|
|
}; |
|
|
|
|
# endif//GLM_HAS_BITSCAN_WINDOWS |
|
|
|
|
}//namespace detail |
|
|
|
|
template<typename genType> |
|
|
|
|
GLM_FUNC_QUALIFIER int iround(genType x) |
|
|
|
|
{ |
|
|
|
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'iround' only accept floating-point inputs"); |
|
|
|
|
assert(static_cast<genType>(0.0) <= x); |
|
|
|
|
|
|
|
|
|
return static_cast<int>(x + static_cast<genType>(0.5)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<length_t L, typename T, qualifier Q> |
|
|
|
|
GLM_FUNC_QUALIFIER vec<L, int, Q> iround(vec<L, T, Q> const& x) |
|
|
|
|
{ |
|
|
|
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'iround' only accept floating-point inputs"); |
|
|
|
|
assert(all(lessThanEqual(vec<L, T, Q>(0), x))); |
|
|
|
|
|
|
|
|
|
return vec<L, int, Q>(x + static_cast<T>(0.5)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<typename genType> |
|
|
|
|
GLM_FUNC_QUALIFIER uint uround(genType x) |
|
|
|
|
{ |
|
|
|
|
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'uround' only accept floating-point inputs"); |
|
|
|
|
assert(static_cast<genType>(0.0) <= x); |
|
|
|
|
|
|
|
|
|
return static_cast<uint>(x + static_cast<genType>(0.5)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<length_t L, typename T, qualifier Q> |
|
|
|
|
GLM_FUNC_QUALIFIER vec<L, uint, Q> uround(vec<L, T, Q> const& x) |
|
|
|
|
{ |
|
|
|
|
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'uround' only accept floating-point inputs"); |
|
|
|
|
assert(all(lessThanEqual(vec<L, T, Q>(0), x))); |
|
|
|
|
|
|
|
|
|
return vec<L, uint, Q>(x + static_cast<T>(0.5)); |
|
|
|
|
} |
|
|
|
|
}//namespace glm |
|
|
|
|