mirror of https://github.com/google/snappy.git
Improve the SSE2 macro check on Windows.
This lands https://github.com/google/snappy/pull/37
This commit is contained in:
parent
7dadceea52
commit
7b9532b878
13
snappy.cc
13
snappy.cc
|
@ -30,7 +30,16 @@
|
||||||
#include "snappy-internal.h"
|
#include "snappy-internal.h"
|
||||||
#include "snappy-sinksource.h"
|
#include "snappy-sinksource.h"
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifndef SNAPPY_HAVE_SSE2
|
||||||
|
#if defined(__SSE2__) || defined(_M_X64) || \
|
||||||
|
(defined(_M_IX86_FP) && _M_IX86_FP >= 2)
|
||||||
|
#define SNAPPY_HAVE_SSE2 1
|
||||||
|
#else
|
||||||
|
#define SNAPPY_HAVE_SSE2 0
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if SNAPPY_HAVE_SSE2
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
#endif
|
#endif
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -96,7 +105,7 @@ void UnalignedCopy64(const void* src, void* dst) {
|
||||||
void UnalignedCopy128(const void* src, void* dst) {
|
void UnalignedCopy128(const void* src, void* dst) {
|
||||||
// TODO(alkis): Remove this when we upgrade to a recent compiler that emits
|
// TODO(alkis): Remove this when we upgrade to a recent compiler that emits
|
||||||
// SSE2 moves for memcpy(dst, src, 16).
|
// SSE2 moves for memcpy(dst, src, 16).
|
||||||
#ifdef __SSE2__
|
#if SNAPPY_HAVE_SSE2
|
||||||
__m128i x = _mm_loadu_si128(static_cast<const __m128i*>(src));
|
__m128i x = _mm_loadu_si128(static_cast<const __m128i*>(src));
|
||||||
_mm_storeu_si128(static_cast<__m128i*>(dst), x);
|
_mm_storeu_si128(static_cast<__m128i*>(dst), x);
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue