bit.hpp
00001 
00002 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
00004 // Created : 2007-03-14
00005 // Updated : 2008-11-14
00006 // Licence : This source is under MIT License
00007 // File    : glm/gtx/bit.hpp
00009 // Dependency:
00010 // - GLM core
00011 // - GLM_GTC_half_float
00013 
00014 #ifndef glm_gtx_bit
00015 #define glm_gtx_bit
00016 
00017 // Dependency:
00018 #include "../glm.hpp"
00019 #include "../gtc/half_float.hpp"
00020 
00021 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
00022 #       pragma message("GLM: GLM_GTX_bit extension included")
00023 #endif
00024 
00025 namespace glm{
00026 namespace gtx{
00027 namespace bit 
00028 {
00029         using namespace gtc::half_float;
00030 
00033 
00036         template <typename genIType>
00037         genIType mask(genIType const & count);
00038 
00042         template <typename genIUType, typename sizeType>
00043         genIUType extractField(
00044                 genIUType const & v, 
00045                 sizeType const & first, 
00046                 sizeType const & count);
00047 
00050         template <typename genType> 
00051         int lowestBit(genType const & value);
00052 
00055         template <typename genType> 
00056         int highestBit(genType const & value);
00057 
00060         template <typename genType> 
00061         genType highestBitValue(genType const & value);
00062 
00065         template <typename genType> 
00066         bool isPowerOfTwo(genType const & value);
00067 
00070         template <typename genType> 
00071         genType powerOfTwoAbove(genType const & value);
00072 
00075         template <typename genType> 
00076         genType powerOfTwoBelow(genType const & value);
00077 
00080         template <typename genType> 
00081         genType powerOfTwoNearest(genType const & value);
00082 
00085         template <typename genType> 
00086         genType bitRevert(genType const & value);
00087 
00090         template <typename genType>
00091         genType bitRotateRight(genType const & In, std::size_t Shift);
00092 
00095         template <typename genType>
00096         genType bitRotateLeft(genType const & In, std::size_t Shift);
00097 
00099 }//namespace bit
00100 }//namespace gtx
00101 }//namespace glm
00102 
00103 #include "bit.inl"
00104 
00105 namespace glm{using namespace gtx::bit;}
00106 
00107 #endif//glm_gtx_bit