Commit db4dba1b authored by Julio C. Rocha's avatar Julio C. Rocha Committed by Facebook Github Bot

Add ARM64 support. (#1191)

Summary:
Allow builds for 64-bit ARM (MSVC) to use the same implementation of `__builtin_clzll` as ARM and x86 architectures.
Pull Request resolved: https://github.com/facebook/folly/pull/1191

Test Plan: Imported from GitHub, without a `Test Plan:` line.

Reviewed By: yfeldblum

Differential Revision: D16350573

Pulled By: Orvid

fbshipit-source-id: f25087b3a53de09767f505ee8c7d971a6d957189
parent d819b1fe
......@@ -50,7 +50,7 @@ FOLLY_ALWAYS_INLINE int __builtin_clzl(unsigned long x) {
return __builtin_clz((unsigned int)x);
}
#if defined(_M_IX86) || defined(_M_ARM)
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_ARM64)
FOLLY_ALWAYS_INLINE int __builtin_clzll(unsigned long long x) {
if (x == 0) {
return 64;
......@@ -75,7 +75,7 @@ FOLLY_ALWAYS_INLINE int __builtin_ctzl(unsigned long x) {
return __builtin_ctz((unsigned int)x);
}
#if defined(_M_IX86) || defined(_M_ARM)
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_ARM64)
FOLLY_ALWAYS_INLINE int __builtin_ctzll(unsigned long long x) {
unsigned long index;
unsigned int msb = (unsigned int)(x >> 32);
......@@ -102,7 +102,7 @@ FOLLY_ALWAYS_INLINE int __builtin_ffsl(long x) {
return __builtin_ffs(int(x));
}
#if defined(_M_IX86) || defined(_M_ARM)
#if defined(_M_IX86) || defined(_M_ARM) || defined(_M_ARM64)
FOLLY_ALWAYS_INLINE int __builtin_ffsll(long long x) {
int ctzll = __builtin_ctzll((unsigned long long)x);
return ctzll != 64 ? ctzll + 1 : 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