summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralkis <alkis@google.com>2017-06-06 01:05:05 -0700
committerVictor Costan <pwnall@chromium.org>2017-06-28 18:33:13 -0700
commit18488d6212331fee647ecfded85353ab3ad91de8 (patch)
treebadc8a2a1525ba578d1eee56f611e67a1dc11651
parent7b9532b8781c5beaf99eef8ca7535d969a129d78 (diff)
downloadsnappy-git-18488d6212331fee647ecfded85353ab3ad91de8.tar.gz
Use 64 bit little endian on ppc64le.
This has tangible performance benefits. This lands https://github.com/google/snappy/pull/27
-rw-r--r--snappy-internal.h5
-rw-r--r--snappy-stubs-internal.h4
2 files changed, 6 insertions, 3 deletions
diff --git a/snappy-internal.h b/snappy-internal.h
index d2a22e8..0cccba1 100644
--- a/snappy-internal.h
+++ b/snappy-internal.h
@@ -80,9 +80,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.
-#if defined(ARCH_K8)
+// Separate implementation for 64-bit, little-endian cpus.
+#if defined(ARCH_K8) || (defined(ARCH_PPC) && !defined(WORDS_BIGENDIAN))
static inline std::pair<size_t, bool> FindMatchLength(const char* s1,
const char* s2,
const char* s2_limit) {
diff --git a/snappy-stubs-internal.h b/snappy-stubs-internal.h
index f818970..6979e1a 100644
--- a/snappy-stubs-internal.h
+++ b/snappy-stubs-internal.h
@@ -52,6 +52,10 @@
// Enable 64-bit optimized versions of some routines.
#define ARCH_K8 1
+#elif defined(__ppc64__)
+
+#define ARCH_PPC 1
+
#endif
// Needed by OS X, among others.