Skip to content

Commit 29e1db8

Browse files
authored
Possible fix for ppc64le platform (#51)
* Possible fix for ppc64le platform
1 parent 1da287a commit 29e1db8

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

suitesparse_graphblas/__init__.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
import platform
88

99
_is_osx_arm64 = platform.machine() == "arm64"
10+
_is_ppc64le = platform.machine() == "ppc64le"
1011
_c_float = ffi.typeof("float")
1112
_c_double = ffi.typeof("double")
1213

1314

14-
if _is_osx_arm64:
15+
if _is_osx_arm64 or _is_ppc64le:
1516

1617
def vararg(val):
1718
# Interpret float as int32 and double as int64
@@ -25,6 +26,8 @@ def vararg(val):
2526
val = ffi.cast("int64_t", val)
2627
# Cast variadic argument as char * to force it onto the stack where ARM64 expects it
2728
# https://developer.apple.com/documentation/xcode/writing-arm64-code-for-apple-platforms
29+
#
30+
# The same fix *may* work for ppc64le
2831
return ffi.cast("char *", val)
2932

3033
else:

suitesparse_graphblas/build.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
is_win = sys.platform.startswith("win")
88
is_arm64 = platform.machine() == "arm64"
9+
is_ppc64le = platform.machine() == "ppc64le" # Use same header as arm64, which *may* work
910
thisdir = os.path.dirname(__file__)
1011

1112
ffibuilder = FFI()
@@ -30,7 +31,7 @@
3031
header = "suitesparse_graphblas.h"
3132
if is_win:
3233
header = "suitesparse_graphblas_no_complex.h"
33-
if is_arm64:
34+
if is_arm64 or is_ppc64le:
3435
header = "suitesparse_graphblas_arm64.h"
3536
gb_cdef = open(os.path.join(thisdir, header))
3637

0 commit comments

Comments
 (0)