diff --git a/test/core/core_func_common.cpp b/test/core/core_func_common.cpp index fb1e4c6e..7521ac2c 100644 --- a/test/core/core_func_common.cpp +++ b/test/core/core_func_common.cpp @@ -739,6 +739,60 @@ int test_isinf() return Error; } +namespace sign +{ + template + GLM_FUNC_QUALIFIER genFIType sign_if(genFIType x) + { + GLM_STATIC_ASSERT( + std::numeric_limits::is_iec559 || + (std::numeric_limits::is_signed && std::numeric_limits::is_integer), "'sign' only accept signed inputs"); + + genFIType result; + if(x > genFIType(0)) + result = genFIType(1); + else if(x < genFIType(0)) + result = genFIType(-1); + else + result = genFIType(0); + return result; + } + + template + GLM_FUNC_QUALIFIER genFIType sign_alu1(genFIType x) + { + GLM_STATIC_ASSERT( + std::numeric_limits::is_signed && std::numeric_limits::is_integer, + "'sign' only accept integer inputs"); + + return (x >> 31) | (-x >> 31); + } + + template + GLM_FUNC_QUALIFIER genFIType sign_alu2(genFIType x) + { + GLM_STATIC_ASSERT( + std::numeric_limits::is_signed && std::numeric_limits::is_integer, + "'sign' only accept integer inputs"); + + return -(x >> 31) | (-x >> 31); + } + + int test() + { + int Error = 0; + + return Error; + } + + int perf() + { + int Error = 0; + + return Error; + } +}//namespace sign + int main() { int Error(0);