From 99cb95f7379a95f978fd04d183fde2d262b262a6 Mon Sep 17 00:00:00 2001 From: Julian Taylor Date: Mon, 6 May 2013 19:24:10 +0200 Subject: ENH: optimize byteswapping via intrinsics Byteswapping is implemented in hardware on x86 cpus which is more than double as fast than the existing implementation. The masked version used for 32bit plays better with compiler pattern matching so it can be optimized also by non-gcc/clang compilers. --- numpy/core/setup_common.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'numpy/core/setup_common.py') diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py index a1a9ac9af..e778e507b 100644 --- a/numpy/core/setup_common.py +++ b/numpy/core/setup_common.py @@ -101,7 +101,10 @@ OPTIONAL_STDFUNCS = ["expm1", "log1p", "acosh", "asinh", "atanh", # call arguments are required as the compiler will do strict signature checking OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'), ("__builtin_isinf", '5.'), - ("__builtin_isfinite", '5.')] + ("__builtin_isfinite", '5.'), + ("__builtin_bswap32", '5u'), + ("__builtin_bswap64", '5u'), + ] # Subset of OPTIONAL_STDFUNCS which may alreay have HAVE_* defined by Python.h OPTIONAL_STDFUNCS_MAYBE = ["expm1", "log1p", "acosh", "atanh", "asinh", "hypot", -- cgit v1.2.1