Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Buildfix!
  • Loading branch information
jordan-woyak committed Mar 5, 2013
1 parent 10d57a3 commit fe3a54d
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions Source/Core/Common/Src/MathUtil.h
Expand Up @@ -152,18 +152,17 @@ float MathFloatVectorSum(const std::vector<float>&);
#define ROUND_UP(x, a) (((x) + (a) - 1) & ~((a) - 1))
#define ROUND_DOWN(x, a) ((x) & ~((a) - 1))

template <typename T>
T Log2(T val)
// Rounds down. 0 -> undefined
inline u64 Log2(u64 val)
{
#if defined(_M_X64)
T result;
asm
(
"bsr %1, %0"
: "=r"(result)
: "r"(val)
);
#if defined(__GNUC__)
return 63 - __builtin_clzll(val);

#elif defined(_MSC_VER)
unsigned long result = -1;
_BitScanReverse64(&result, val);
return result;

#else
T result = -1;
while (val != 0)
Expand Down

0 comments on commit fe3a54d

Please sign in to comment.