Просмотр исходного кода

util: Add util_unsigned_logbase2.

Cherry picked from Keith's commit f911c3b989.
tags/mesa_7_6_rc1
José Fonseca 16 лет назад
Родитель
Сommit
fdb3e75f7e
1 измененных файлов: 12 добавлений и 0 удалений
  1. 12
    0
      src/gallium/auxiliary/util/u_math.h

+ 12
- 0
src/gallium/auxiliary/util/u_math.h Просмотреть файл

@@ -375,6 +375,18 @@ unsigned ffs( unsigned u )
#endif


/* Could also binary search for the highest bit.
*/
static INLINE unsigned
util_unsigned_logbase2(unsigned n)
{
unsigned log2 = 0;
while (n >>= 1)
++log2;
return log2;
}


/**
* Return float bits.
*/

Загрузка…
Отмена
Сохранить