Commit f79d6393 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot 0

Implement __builtin_ctzll for MSVC

Summary: MSVC doesn't have it, but Folly uses it, so implement it in the Builtins portability header.

Reviewed By: yfeldblum

Differential Revision: D3256123

fb-gh-sync-id: fd9ea1b6098d97cf1fde4732905bae9bde8cd8ad
fbshipit-source-id: fd9ea1b6098d97cf1fde4732905bae9bde8cd8ad
parent 32e0fe56
......@@ -35,6 +35,11 @@ FOLLY_ALWAYS_INLINE int __builtin_clzll(unsigned long long x) {
return (int)(_BitScanReverse64(&index, x) ? 63 - index : 64);
}
FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) {
unsigned long index;
return (int)(_BitScanForward64(&index, x) ? index : 64);
}
FOLLY_ALWAYS_INLINE int __builtin_ffs(int x) {
unsigned long index;
return (int)(_BitScanForward(&index, (unsigned long)x) ? index : 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment