Skip to content
Snippets Groups Projects
Commit fcd83633 authored by Yichao Yu's avatar Yichao Yu
Browse files

Use the documented struct.calcsize to determine machine word size for better pypy support.

parent 3e825e66
No related branches found
No related tags found
No related merge requests found
...@@ -42,13 +42,14 @@ from pyopencl.compyte.dtypes import ( # noqa ...@@ -42,13 +42,14 @@ from pyopencl.compyte.dtypes import ( # noqa
def _register_types(): def _register_types():
from pyopencl.compyte.dtypes import _fill_dtype_registry from pyopencl.compyte.dtypes import _fill_dtype_registry
import struct
_fill_dtype_registry(respect_windows=False, include_bool=False) _fill_dtype_registry(respect_windows=False, include_bool=False)
get_or_register_dtype("cfloat_t", np.complex64) get_or_register_dtype("cfloat_t", np.complex64)
get_or_register_dtype("cdouble_t", np.complex128) get_or_register_dtype("cdouble_t", np.complex128)
is_64_bit = tuple.__itemsize__ * 8 == 64 is_64_bit = struct.calcsize('@P') * 8 == 64
if not is_64_bit: if not is_64_bit:
get_or_register_dtype( get_or_register_dtype(
["unsigned long", "unsigned long int"], np.uint64) ["unsigned long", "unsigned long int"], np.uint64)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment