aboutsummaryrefslogtreecommitdiffstats
path: root/OpenAL32
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2018-01-27 11:11:39 -0800
committerChris Robinson <[email protected]>2018-01-27 11:11:39 -0800
commit9718502e5db46952693d550c54ec35b0a44128d3 (patch)
tree14ee1ae3eaeb24bc7c837338b87395f0659115f0 /OpenAL32
parent9613b4bfe24cbefba0f4c9c738ebd30d4b116970 (diff)
Check for _BitScanForward64 before using it
Diffstat (limited to 'OpenAL32')
-rw-r--r--OpenAL32/Include/alMain.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/OpenAL32/Include/alMain.h b/OpenAL32/Include/alMain.h
index f3ffac29..afa3eee3 100644
--- a/OpenAL32/Include/alMain.h
+++ b/OpenAL32/Include/alMain.h
@@ -97,13 +97,13 @@ typedef ALuint64SOFT ALuint64;
#define CTZ64(x) __builtin_ctzll(x)
#endif
-#elif defined(_MSC_VER)
+#elif defined(HAVE_BITSCANFORWARD64_INTRINSIC)
static inline int msvc_ctz64(ALuint64 v)
{
- unsigned long idx = 0;
+ unsigned long idx = 64;
_BitScanForward64(&idx, v);
- return idx;
+ return (int)idx;
}
#define CTZ64(x) msvc_ctz64(x)
@@ -121,7 +121,7 @@ static inline int fallback_popcnt64(ALuint64 v)
v = v - ((v >> 1) & U64(0x5555555555555555));
v = (v & U64(0x3333333333333333)) + ((v >> 2) & U64(0x3333333333333333));
v = (v + (v >> 4)) & U64(0x0f0f0f0f0f0f0f0f);
- return (v * U64(0x0101010101010101)) >> 56;
+ return (int)((v * U64(0x0101010101010101)) >> 56);
}
static inline int fallback_ctz64(ALuint64 value)