diff --git a/glm/gtx/bit.hpp b/glm/gtx/bit.hpp index eb044181..23586940 100644 --- a/glm/gtx/bit.hpp +++ b/glm/gtx/bit.hpp @@ -76,11 +76,6 @@ namespace glm template GLM_FUNC_DECL genType powerOfTwoNearest(genType const & value); - //! Revert all bits of any integer based type. - /// @see gtx_bit - template - GLM_DEPRECATED GLM_FUNC_DECL genType bitRevert(genType const & value); - //! Set to 1 a range of bits. /// @see gtx_bit template diff --git a/glm/gtx/bit.inl b/glm/gtx/bit.inl index 21d84d47..9ee27331 100644 --- a/glm/gtx/bit.inl +++ b/glm/gtx/bit.inl @@ -153,21 +153,6 @@ namespace glm VECTORIZE_VEC(powerOfTwoNearest) - template - GLM_FUNC_QUALIFIER genType bitRevert(genType const & In) - { - GLM_STATIC_ASSERT(std::numeric_limits::is_integer, "'bitRevert' only accept integer values"); - - genType Out = 0; - std::size_t BitSize = sizeof(genType) * 8; - for(std::size_t i = 0; i < BitSize; ++i) - if(In & (genType(1) << i)) - Out |= genType(1) << (BitSize - 1 - i); - return Out; - } - - VECTORIZE_VEC(bitRevert) - template GLM_FUNC_QUALIFIER genIUType fillBitfieldWithOne ( diff --git a/test/core/core_func_integer.cpp b/test/core/core_func_integer.cpp index 6cbe5f0c..0f40e207 100644 --- a/test/core/core_func_integer.cpp +++ b/test/core/core_func_integer.cpp @@ -9,9 +9,9 @@ #include #include -#include #include #include +#include enum result { @@ -148,7 +148,25 @@ namespace bitfieldReverse {0xf0000000, 0x0000000f, SUCCESS}, }; - int test() + typedef type typeU64; + +#if(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && (GLM_COMPILER < GLM_COMPILER_GCC44)) + typeU64 const Data64[] = + { + {0xffffffffffffffffLLU, 0xffffffffffffffffLLU, SUCCESS}, + {0x0000000000000000LLU, 0x0000000000000000LLU, SUCCESS}, + {0xf000000000000000LLU, 0x000000000000000fLLU, SUCCESS}, + }; +#else + typeU64 const Data64[] = + { + {0xffffffffffffffff, 0xffffffffffffffff, SUCCESS}, + {0x0000000000000000, 0x0000000000000000, SUCCESS}, + {0xf000000000000000, 0x000000000000000f, SUCCESS}, + }; +#endif + + int test32() { glm::uint count = sizeof(Data32) / sizeof(typeU32); @@ -164,13 +182,46 @@ namespace bitfieldReverse else if(Data32[i].Result == FAIL && !Compare) continue; - std::cout << "glm::bitfieldReverse test fail on test " << i << std::endl; + printf("glm::bitfieldReverse test fail on test %d\n", i); return 1; } return 0; } -}//bitRevert + + int test64() + { + glm::uint32 count = sizeof(Data64) / sizeof(typeU64); + + for(glm::uint32 i = 0; i < count; ++i) + { + glm::uint64 Return = glm::bitfieldReverse( + Data64[i].Value); + + bool Compare = Data64[i].Return == Return; + + if(Data64[i].Result == SUCCESS && Compare) + continue; + else if(Data64[i].Result == FAIL && !Compare) + continue; + + printf("glm::extractfield test fail on test %d\n", i); + return 1; + } + + return 0; + } + + int test() + { + int Error = 0; + + Error += test32(); + Error += test64(); + + return Error; + } +}//bitfieldReverse namespace findMSB { @@ -639,8 +690,6 @@ int main() { int Error = 0; - std::cout << "sizeof(glm::uint64): " << sizeof(glm::detail::uint64) << std::endl; - Error += ::umulExtended::test(); Error += ::imulExtended::test(); Error += ::uaddCarry::test(); diff --git a/test/gtx/gtx_bit.cpp b/test/gtx/gtx_bit.cpp index 2dc66375..b8009f40 100644 --- a/test/gtx/gtx_bit.cpp +++ b/test/gtx/gtx_bit.cpp @@ -10,79 +10,11 @@ #include #include -#if(GLM_ARCH != GLM_ARCH_PURE) -# include -#endif -#include -#include -#include - -enum result -{ - SUCCESS, - FAIL, - ASSERT, - STATIC_ASSERT -}; - -namespace bitRevert -{ - template - struct type - { - genType Value; - genType Return; - result Result; - }; - - typedef type typeU64; - -#if(((GLM_COMPILER & GLM_COMPILER_GCC) == GLM_COMPILER_GCC) && (GLM_COMPILER < GLM_COMPILER_GCC44)) - typeU64 const Data64[] = - { - {0xffffffffffffffffLLU, 0xffffffffffffffffLLU, SUCCESS}, - {0x0000000000000000LLU, 0x0000000000000000LLU, SUCCESS}, - {0xf000000000000000LLU, 0x000000000000000fLLU, SUCCESS}, - }; -#else - typeU64 const Data64[] = - { - {0xffffffffffffffff, 0xffffffffffffffff, SUCCESS}, - {0x0000000000000000, 0x0000000000000000, SUCCESS}, - {0xf000000000000000, 0x000000000000000f, SUCCESS}, - }; -#endif - - int test() - { - glm::uint32 count = sizeof(Data64) / sizeof(typeU64); - - for(glm::uint32 i = 0; i < count; ++i) - { - glm::uint64 Return = glm::bitRevert( - Data64[i].Value); - - bool Compare = Data64[i].Return == Return; - - if(Data64[i].Result == SUCCESS && Compare) - continue; - else if(Data64[i].Result == FAIL && !Compare) - continue; - - printf("glm::extractfield test fail on test %d\n", i); - return 1; - } - - return 0; - } -}//bitRevert int main() { int Error(0); - Error += ::bitRevert::test(); - return Error; }