From b42c4acb44cced8d208222831d26f09feeb83308 Mon Sep 17 00:00:00 2001 From: Soumitra Chatterjee Date: Tue, 5 Apr 2016 17:55:08 +0530 Subject: [PATCH 1/2] Support for AArch64 --- snappy-internal.h | 4 ++-- snappy-stubs-internal.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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..dfbb723 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 From 3af97d3579a1d7e3f910d2458482be341771d9b7 Mon Sep 17 00:00:00 2001 From: Soumitra Chatterjee Date: Wed, 6 Apr 2016 00:05:38 +0530 Subject: [PATCH 2/2] Support for AArch64 --- snappy-stubs-internal.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h index dfbb723..923b99e 100644 --- a/snappy-stubs-internal.h +++ b/snappy-stubs-internal.h @@ -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))