GLM  0.9.5
bit.hpp
Go to the documentation of this file.
1 
39 #ifndef GLM_GTX_bit
40 #define GLM_GTX_bit
41 
42 // Dependencies
43 #include "../detail/type_int.hpp"
44 #include "../detail/setup.hpp"
45 #include <cstddef>
46 
47 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
48 # pragma message("GLM: GLM_GTX_bit extension included")
49 #endif
50 
51 namespace glm
52 {
55 
58  template <typename genIType>
59  GLM_FUNC_DECL genIType mask(genIType const & count);
60 
63  template <typename genType>
64  GLM_FUNC_DECL genType highestBitValue(genType const & value);
65 
68  template <typename genType>
69  GLM_FUNC_DECL bool isPowerOfTwo(genType const & value);
70 
73  template <typename genType>
74  GLM_FUNC_DECL genType powerOfTwoAbove(genType const & value);
75 
78  template <typename genType>
79  GLM_FUNC_DECL genType powerOfTwoBelow(genType const & value);
80 
83  template <typename genType>
84  GLM_FUNC_DECL genType powerOfTwoNearest(genType const & value);
85 
88  template <typename genType>
89  GLM_DEPRECATED GLM_FUNC_DECL genType bitRevert(genType const & value);
90 
93  template <typename genType>
94  GLM_FUNC_DECL genType bitRotateRight(genType const & In, std::size_t Shift);
95 
98  template <typename genType>
99  GLM_FUNC_DECL genType bitRotateLeft(genType const & In, std::size_t Shift);
100 
103  template <typename genIUType>
104  GLM_FUNC_DECL genIUType fillBitfieldWithOne(
105  genIUType const & Value,
106  int const & FromBit,
107  int const & ToBit);
108 
111  template <typename genIUType>
112  GLM_FUNC_DECL genIUType fillBitfieldWithZero(
113  genIUType const & Value,
114  int const & FromBit,
115  int const & ToBit);
116 
122  GLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y);
123 
129  GLM_FUNC_DECL uint16 bitfieldInterleave(uint8 x, uint8 y);
130 
136  GLM_FUNC_DECL int32 bitfieldInterleave(int16 x, int16 y);
137 
143  GLM_FUNC_DECL uint32 bitfieldInterleave(uint16 x, uint16 y);
144 
150  GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y);
151 
157  GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y);
158 
164  GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z);
165 
171  GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z);
172 
178  GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z);
179 
185  GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z);
186 
192  GLM_FUNC_DECL int64 bitfieldInterleave(int32 x, int32 y, int32 z);
193 
199  GLM_FUNC_DECL uint64 bitfieldInterleave(uint32 x, uint32 y, uint32 z);
200 
206  GLM_FUNC_DECL int32 bitfieldInterleave(int8 x, int8 y, int8 z, int8 w);
207 
213  GLM_FUNC_DECL uint32 bitfieldInterleave(uint8 x, uint8 y, uint8 z, uint8 w);
214 
220  GLM_FUNC_DECL int64 bitfieldInterleave(int16 x, int16 y, int16 z, int16 w);
221 
227  GLM_FUNC_DECL uint64 bitfieldInterleave(uint16 x, uint16 y, uint16 z, uint16 w);
228 
230 } //namespace glm
231 
232 #include "bit.inl"
233 
234 #endif//GLM_GTX_bit
GLM_FUNC_DECL genType highestBitValue(genType const &value)
Find the highest bit set to 1 in a integer variable and return its value.
detail::int8 int8
8 bit signed integer type.
Definition: type_int.hpp:89
detail::uint32 uint32
32 bit unsigned integer type.
Definition: type_int.hpp:96
detail::int16 int16
16 bit signed integer type.
Definition: type_int.hpp:90
detail::int64 int64
64 bit signed integer type.
Definition: type_int.hpp:92
GLM_FUNC_DECL genType powerOfTwoNearest(genType const &value)
Return the power of two number which value is the closet to the input value.
GLM_FUNC_DECL genType bitRotateLeft(genType const &In, std::size_t Shift)
Rotate all bits to the left.
GLM_FUNC_DECL genIType mask(genIType const &count)
Build a mask of &#39;count&#39; bits.
detail::uint64 uint64
64 bit unsigned integer type.
Definition: type_int.hpp:97
detail::int32 int32
32 bit signed integer type.
Definition: type_int.hpp:91
GLM_FUNC_DECL genIUType fillBitfieldWithOne(genIUType const &Value, int const &FromBit, int const &ToBit)
Set to 1 a range of bits.
GLM_FUNC_DECL genType bitRotateRight(genType const &In, std::size_t Shift)
Rotate all bits to the right.
detail::uint8 uint8
8 bit unsigned integer type.
Definition: type_int.hpp:94
GLM_FUNC_DECL bool isPowerOfTwo(genType const &value)
Return true if the value is a power of two number.
GLM_DEPRECATED GLM_FUNC_DECL genType bitRevert(genType const &value)
Revert all bits of any integer based type.
GLM_FUNC_DECL genType powerOfTwoBelow(genType const &value)
Return the power of two number which value is just lower the input value.
detail::uint16 uint16
16 bit unsigned integer type.
Definition: type_int.hpp:95
GLM_FUNC_DECL genIUType fillBitfieldWithZero(genIUType const &Value, int const &FromBit, int const &ToBit)
Set to 0 a range of bits.
GLM_FUNC_DECL int16 bitfieldInterleave(int8 x, int8 y)
Interleaves the bits of x and y.
GLM_FUNC_DECL genType powerOfTwoAbove(genType const &value)
Return the power of two number which value is just higher the input value.