Function glm::builtin::findMSB
[−]
[src]
pub fn findMSB<B: BaseInt, I: GenIType, T: IntIntRel<B, I>>(value: T) -> I
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.
Example
use glm::{ findMSB, ivec3 }; assert_eq!(findMSB(0_i32), -1); assert_eq!(findMSB(ivec3(-1, -2, 0x7FFFFFFF)), ivec3(-1, 0, 30));