0.9.8 API documenation
|
These all operate component-wise. More...
Functions | |
template<typename genType > | |
GLM_FUNC_DECL int | bitCount (genType v) |
Returns the number of bits set to 1 in the binary representation of value. More... | |
template<typename T , precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< int, P > | bitCount (vecType< T, P > const &v) |
Returns the number of bits set to 1 in the binary representation of value. More... | |
template<typename T , precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< T, P > | bitfieldExtract (vecType< T, P > const &Value, int Offset, int Bits) |
Extracts bits [offset, offset + bits - 1] from value, returning them in the least significant bits of the result. More... | |
template<typename T , precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< T, P > | bitfieldInsert (vecType< T, P > const &Base, vecType< T, P > const &Insert, int Offset, int Bits) |
Returns the insertion the bits least-significant bits of insert into base. More... | |
template<typename T , precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< T, P > | bitfieldReverse (vecType< T, P > const &v) |
Returns the reversal of the bits of value. More... | |
template<typename genIUType > | |
GLM_FUNC_DECL int | findLSB (genIUType x) |
Returns the bit number of the least significant bit set to 1 in the binary representation of value. More... | |
template<typename T , precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< int, P > | findLSB (vecType< T, P > const &v) |
Returns the bit number of the least significant bit set to 1 in the binary representation of value. More... | |
template<typename genIUType > | |
GLM_FUNC_DECL int | findMSB (genIUType x) |
Returns the bit number of the most significant bit in the binary representation of value. More... | |
template<typename T , precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< int, P > | findMSB (vecType< T, P > const &v) |
Returns the bit number of the most significant bit in the binary representation of value. More... | |
template<precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL void | imulExtended (vecType< int, P > const &x, vecType< int, P > const &y, vecType< int, P > &msb, vecType< int, P > &lsb) |
Multiplies 32-bit integers x and y, producing a 64-bit result. More... | |
template<precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< uint, P > | uaddCarry (vecType< uint, P > const &x, vecType< uint, P > const &y, vecType< uint, P > &carry) |
Adds 32-bit unsigned integer x and y, returning the sum modulo pow(2, 32). More... | |
template<precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL void | umulExtended (vecType< uint, P > const &x, vecType< uint, P > const &y, vecType< uint, P > &msb, vecType< uint, P > &lsb) |
Multiplies 32-bit integers x and y, producing a 64-bit result. More... | |
template<precision P, template< typename, precision > class vecType> | |
GLM_FUNC_DECL vecType< uint, P > | usubBorrow (vecType< uint, P > const &x, vecType< uint, P > const &y, vecType< uint, P > &borrow) |
Subtracts the 32-bit unsigned integer y from x, returning the difference if non-negative, or pow(2, 32) plus the difference otherwise. More... | |
These all operate component-wise.
The description is per component. The notation [a, b] means the set of bits from bit-number a through bit-number b, inclusive. The lowest-order bit is bit 0.
GLM_FUNC_DECL int glm::bitCount | ( | genType | v | ) |
Returns the number of bits set to 1 in the binary representation of value.
T | Signed or unsigned integer scalar or vector types. |
GLM_FUNC_DECL vecType<int, P> glm::bitCount | ( | vecType< T, P > const & | v | ) |
Returns the number of bits set to 1 in the binary representation of value.
T | Signed or unsigned integer scalar or vector types. |
GLM_FUNC_DECL vecType<T, P> glm::bitfieldExtract | ( | vecType< T, P > const & | Value, |
int | Offset, | ||
int | Bits | ||
) |
Extracts bits [offset, offset + bits - 1] from value, returning them in the least significant bits of the result.
For unsigned data types, the most significant bits of the result will be set to zero. For signed data types, the most significant bits will be set to the value of bit offset + base - 1.
If bits is zero, the result will be zero. The result will be undefined if offset or bits is negative, or if the sum of offset and bits is greater than the number of bits used to store the operand.
T | Signed or unsigned integer scalar or vector types. |
GLM_FUNC_DECL vecType<T, P> glm::bitfieldInsert | ( | vecType< T, P > const & | Base, |
vecType< T, P > const & | Insert, | ||
int | Offset, | ||
int | Bits | ||
) |
Returns the insertion the bits least-significant bits of insert into base.
The result will have bits [offset, offset + bits - 1] taken from bits [0, bits - 1] of insert, and all other bits taken directly from the corresponding bits of base. If bits is zero, the result will simply be base. The result will be undefined if offset or bits is negative, or if the sum of offset and bits is greater than the number of bits used to store the operand.
T | Signed or unsigned integer scalar or vector types. |
GLM_FUNC_DECL vecType<T, P> glm::bitfieldReverse | ( | vecType< T, P > const & | v | ) |
Returns the reversal of the bits of value.
The bit numbered n of the result will be taken from bit (bits - 1) - n of value, where bits is the total number of bits used to represent value.
T | Signed or unsigned integer scalar or vector types. |
GLM_FUNC_DECL int glm::findLSB | ( | genIUType | x | ) |
Returns the bit number of the least significant bit set to 1 in the binary representation of value.
If value is zero, -1 will be returned.
T | Signed or unsigned integer scalar types. |
GLM_FUNC_DECL vecType<int, P> glm::findLSB | ( | vecType< T, P > const & | v | ) |
Returns the bit number of the least significant bit set to 1 in the binary representation of value.
If value is zero, -1 will be returned.
T | Signed or unsigned integer scalar types. |
GLM_FUNC_DECL int glm::findMSB | ( | genIUType | x | ) |
Returns the bit number of the most significant bit in the binary representation of value.
For positive integers, the result will be the bit number of the most significant bit set to 1. For negative integers, the result will be the bit number of the most significant bit set to 0. For a value of zero or negative one, -1 will be returned.
T | Signed or unsigned integer scalar types. |
GLM_FUNC_DECL vecType<int, P> glm::findMSB | ( | vecType< T, P > const & | v | ) |
Returns the bit number of the most significant bit in the binary representation of value.
For positive integers, the result will be the bit number of the most significant bit set to 1. For negative integers, the result will be the bit number of the most significant bit set to 0. For a value of zero or negative one, -1 will be returned.
T | Signed or unsigned integer scalar types. |
GLM_FUNC_DECL void glm::imulExtended | ( | vecType< int, P > const & | x, |
vecType< int, P > const & | y, | ||
vecType< int, P > & | msb, | ||
vecType< int, P > & | lsb | ||
) |
Multiplies 32-bit integers x and y, producing a 64-bit result.
The 32 least-significant bits are returned in lsb. The 32 most-significant bits are returned in msb.
genIType | Signed integer scalar or vector types. |
GLM_FUNC_DECL vecType<uint, P> glm::uaddCarry | ( | vecType< uint, P > const & | x, |
vecType< uint, P > const & | y, | ||
vecType< uint, P > & | carry | ||
) |
Adds 32-bit unsigned integer x and y, returning the sum modulo pow(2, 32).
The value carry is set to 0 if the sum was less than pow(2, 32), or to 1 otherwise.
genUType | Unsigned integer scalar or vector types. |
GLM_FUNC_DECL void glm::umulExtended | ( | vecType< uint, P > const & | x, |
vecType< uint, P > const & | y, | ||
vecType< uint, P > & | msb, | ||
vecType< uint, P > & | lsb | ||
) |
Multiplies 32-bit integers x and y, producing a 64-bit result.
The 32 least-significant bits are returned in lsb. The 32 most-significant bits are returned in msb.
genUType | Unsigned integer scalar or vector types. |
GLM_FUNC_DECL vecType<uint, P> glm::usubBorrow | ( | vecType< uint, P > const & | x, |
vecType< uint, P > const & | y, | ||
vecType< uint, P > & | borrow | ||
) |
Subtracts the 32-bit unsigned integer y from x, returning the difference if non-negative, or pow(2, 32) plus the difference otherwise.
The value borrow is set to 0 if x >= y, or to 1 otherwise.
genUType | Unsigned integer scalar or vector types. |