diff --git a/snappy-internal.h b/snappy-internal.h index c4d1f6d..f3f214c 100644 --- a/snappy-internal.h +++ b/snappy-internal.h @@ -79,8 +79,8 @@ char* CompressFragment(const char* input, // Does not read *(s1 + (s2_limit - s2)) or beyond. // Requires that s2_limit >= s2. // -// Separate implementation for x86_64, for speed. Uses the fact that -// x86_64 is little endian. +// Separate implementation for x86_64/AArch64, for speed. Uses the fact that +// x86_64/AArch64 is little endian. #if defined(ARCH_K8) static inline int FindMatchLength(const char* s1, const char* s2, diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h index 1954c63..923b99e 100644 --- a/snappy-stubs-internal.h +++ b/snappy-stubs-internal.h @@ -47,12 +47,12 @@ #include "snappy-stubs-public.h" -#if defined(__x86_64__) +#if defined(__x86_64__) || defined(__aarch64__) // Enable 64-bit optimized versions of some routines. #define ARCH_K8 1 -#endif +#endif //__x86_64__ || __aarch64__ // Needed by OS X, among others. #ifndef MAP_ANONYMOUS @@ -96,9 +96,10 @@ static const int64 kint64max = static_cast(0x7FFFFFFFFFFFFFFFLL); // Potentially unaligned loads and stores. -// x86 and PowerPC can simply do these loads and stores native. +// x86, ARM64 and PowerPC can simply do these loads and stores native. -#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) +#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) \ + || defined(__aarch64__) #define UNALIGNED_LOAD16(_p) (*reinterpret_cast(_p)) #define UNALIGNED_LOAD32(_p) (*reinterpret_cast(_p))