[pypy-commit] pypy py3.6: mimic more closely what cpython does in Modules/_blake2/_blake2?_impl.c
mattip
pypy.commits at gmail.com
Wed Mar 20 04:59:50 EDT 2019
Author: Matti Picus <matti.picus at gmail.com>
Branch: py3.6
Changeset: r96337:0da5abfd7fd5
Date: 2019-03-20 10:59 +0200
http://bitbucket.org/pypy/pypy/changeset/0da5abfd7fd5/
Log: mimic more closely what cpython does in
Modules/_blake2/_blake2?_impl.c
diff --git a/lib_pypy/_blake2/_blake2_build.py b/lib_pypy/_blake2/_blake2_build.py
--- a/lib_pypy/_blake2/_blake2_build.py
+++ b/lib_pypy/_blake2/_blake2_build.py
@@ -4,19 +4,17 @@
from cffi import FFI
-IS_ARM = platform.machine().startswith('arm')
IS_WIN = sys.platform == 'win32'
-if IS_ARM:
- # XXX Choose neon accelaration
- define_macros = []
- extra_compile_args = []
-elif IS_WIN:
+if IS_WIN:
+ BLAKE2_USE_SSE = True
extra_compile_args = []
define_macros = [('__SSE2__', '1')]
elif platform.machine().startswith('x86'):
+ BLAKE2_USE_SSE = True
extra_compile_args = ['-msse2']
define_macros = []
else:
+ BLAKE2_USE_SSE = False
extra_compile_args = []
define_macros = []
@@ -83,13 +81,18 @@
_libdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'impl'))
+if BLAKE2_USE_SSE:
+ sourcesB=[os.path.join(_libdir, 'blake2b.c'), ],
+ sourcesS=[os.path.join(_libdir, 'blake2s.c'), ],
+else:
+ sourcesB=[os.path.join(_libdir, 'blake2b-ref.c'), ],
+ sourcesS=[os.path.join(_libdir, 'blake2s-ref.c'), ],
blake2b_ffi = FFI()
blake2b_ffi.cdef(blake_cdef)
blake2b_ffi.set_source(
'_blake2b_cffi', blake2b_source,
- sources=[os.path.join(_libdir, 'blake2b.c'),
- ],
+ sources=sourcesB,
include_dirs=[_libdir],
extra_compile_args=extra_compile_args,
define_macros=define_macros,
@@ -105,8 +108,7 @@
blake2s_ffi.cdef(blake_cdef)
blake2s_ffi.set_source(
'_blake2s_cffi', _replace_b2s(blake2b_source),
- sources=[os.path.join(_libdir, 'blake2s.c'),
- ],
+ sources=sourcesS,
include_dirs=[_libdir],
extra_compile_args=extra_compile_args,
define_macros=define_macros,
More information about the pypy-commit
mailing list