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 {
00027         namespace test{
00028                 void main_gtx_bit();
00029         }//namespace test
00030 
00031         namespace gtx{
00033         namespace bit
00034         {
00035                 using namespace gtc::half_float;
00036 
00041                 template <typename genIType>
00042                 genIType mask(genIType const & count);
00043 
00047                 template <typename genIUType, typename sizeType>
00048                 genIUType extractField(
00049                         genIUType const & v, 
00050                         sizeType const & first, 
00051                         sizeType const & count);
00052 
00055                 template <typename genType> 
00056                 int lowestBit(genType const & value);
00057 
00060                 template <typename genType> 
00061                 int highestBit(genType const & value);
00062 
00065                 template <typename genType> 
00066                 genType highestBitValue(genType const & value);
00067 
00070                 template <typename genType> 
00071                 bool isPowerOfTwo(genType const & value);
00072 
00075                 template <typename genType> 
00076                 genType powerOfTwoAbove(genType const & value);
00077 
00080                 template <typename genType> 
00081                 genType powerOfTwoBelow(genType const & value);
00082 
00085                 template <typename genType> 
00086                 genType powerOfTwoNearest(genType const & value);
00087 
00090                 template <typename genType> 
00091                 genType bitRevert(genType const & value);
00092 
00095                 template <typename genType>
00096                 genType bitRotateRight(genType const & In, std::size_t Shift);
00097 
00100                 template <typename genType>
00101                 genType bitRotateLeft(genType const & In, std::size_t Shift);
00103 
00104         }//namespace bit
00105         }//namespace gtx
00106 }//namespace glm
00107 
00108 #include "bit.inl"
00109 
00110 namespace glm{using namespace gtx::bit;}
00111 
00112 #endif//glm_gtx_bit