Check that Python is 64-bit before enabling BLAKE2_USE_SSE. (#1332)

This commit is contained in:
Neil Schemenauer 2017-04-28 09:56:48 -07:00 committed by GitHub
parent d1a1def7bf
commit 6c991bdee7
1 changed files with 5 additions and 2 deletions

View File

@ -898,8 +898,11 @@ class PyBuildExt(build_ext):
blake2_deps.append('hashlib.h')
blake2_macros = []
if not cross_compiling and os.uname().machine == "x86_64":
# Every x86_64 machine has at least SSE2.
if (not cross_compiling and
os.uname().machine == "x86_64" and
sys.maxsize > 2**32):
# Every x86_64 machine has at least SSE2. Check for sys.maxsize
# in case that kernel is 64-bit but userspace is 32-bit.
blake2_macros.append(('BLAKE2_USE_SSE', '1'))
exts.append( Extension('_blake2',