mitsuba-af602c6fd98a/src/libcore/math.cpp
/* Fast rounding & power-of-two test algorithms from PBRT */
Fast rounding & power-of-two test algorithms from PBRT
Fast rounding & power - of - two test algorithms from PBRT
uint32_t roundToPowerOfTwo(uint32_t i) {
	i--;
	i |= i >> 1; i |= i >> 2;
	i |= i >> 4; i |= i >> 8;
	i |= i >> 16;
	return i+1;
}
uint32_t roundToPowerOfTwo ( uint32_t i ) { i -- ; i |= i >> 1 ; i |= i >> 2 ; i |= i >> 4 ; i |= i >> 8 ; i |= i >> 16 ; return i + 1 ; }
Fast rounding & power-of-two test algorithms from PBRT
Fast rounding & power - of - two test algorithms from PBRT