Buildfix!

This commit is contained in:
Jordan Woyak 2013-03-05 15:48:57 -06:00
parent 10d57a3402
commit fe3a54d7fd
1 changed files with 9 additions and 10 deletions

View File

@ -152,18 +152,17 @@ float MathFloatVectorSum(const std::vector<float>&);
#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1)) #define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
#define ROUND_DOWN(x, a) ((x) & ~((a) - 1)) #define ROUND_DOWN(x, a) ((x) & ~((a) - 1))
template <typename T> // Rounds down. 0 -> undefined
T Log2(T val) inline u64 Log2(u64 val)
{ {
#if defined(_M_X64) #if defined(__GNUC__)
T result; return 63 - __builtin_clzll(val);
asm
( #elif defined(_MSC_VER)
"bsr %1, %0" unsigned long result = -1;
: "=r"(result) _BitScanReverse64(&result, val);
: "r"(val)
);
return result; return result;
#else #else
T result = -1; T result = -1;
while (val != 0) while (val != 0)