diff --git a/glm/gtx/ulp.inl b/glm/gtx/ulp.inl index dbd85a35..3f8cbedb 100644 --- a/glm/gtx/ulp.inl +++ b/glm/gtx/ulp.inl @@ -58,7 +58,7 @@ namespace ulp } template - GLM_FUNC_QUALIFIER T next_float(T const & x, std::size_t const & ulps) + GLM_FUNC_QUALIFIER T next_float(T const & x, uint const & ulps) { T temp = x; for(std::size_t i = 0; i < ulps; ++i) @@ -66,8 +66,17 @@ namespace ulp return temp; } + template class vecType> + GLM_FUNC_QUALIFIER vecType next_float(vecType const & x, vecType const & ulps) + { + vecType Result; + for(std::size_t i = 0; i < Result.length(); ++i) + Result[i] = next_float(x[i], ulps[i]); + return Result; + } + template - GLM_FUNC_QUALIFIER T prev_float(T const & x, std::size_t const & ulps) + GLM_FUNC_QUALIFIER T prev_float(T const & x, uint const & ulps) { T temp = x; for(std::size_t i = 0; i < ulps; ++i) @@ -75,8 +84,17 @@ namespace ulp return temp; } + template class vecType> + GLM_FUNC_QUALIFIER vecType prev_float(vecType const & x, vecType const & ulps) + { + vecType Result; + for(std::size_t i = 0; i < Result.length(); ++i) + Result[i] = prev_float(x[i], ulps[i]); + return Result; + } + template - GLM_FUNC_QUALIFIER std::size_t float_distance(T const & x, T const & y) + GLM_FUNC_QUALIFIER uint float_distance(T const & x, T const & y) { std::size_t ulp = 0; @@ -106,6 +124,15 @@ namespace ulp return ulp; } + template class vecType> + GLM_FUNC_QUALIFIER vecType float_distance(vecType const & x, vecType const & y) + { + vecType Result; + for(std::size_t i = 0; i < Result.length(); ++i) + Result[i] = float_distance(x[i], y[i]); + return Result; + } +/* inline std::size_t ulp ( detail::thalf const & a, @@ -202,7 +229,7 @@ namespace ulp return glm::max(glm::max(ulps[0], ulps[1]), glm::max(ulps[2], ulps[3])); } - +*/ }//namespace ulp }//namespace gtx }//namespace glm