Skip to content

Commit

Permalink
Merge pull request #2462 from devitocodes/comp-dtype
Browse files Browse the repository at this point in the history
compiler: Add missing symbolic casts
  • Loading branch information
FabioLuporini authored Oct 4, 2024
2 parents db692d2 + ef578dd commit 7e2694e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions devito/symbolics/extended_sympy.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,14 @@ class UCHAR(Cast):
_base_typ = 'unsigned char'


class UINT(Cast):
_base_typ = 'unsigned int'


class UINTP(CastStar):
base = UINT


class LONG(Cast):
_base_typ = 'long'

Expand Down
4 changes: 3 additions & 1 deletion devito/tools/dtypes_lowering.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,9 @@ def dtype_to_ctype(dtype):
except KeyError:
pass

if issubclass(dtype, ctypes._SimpleCData):
if isinstance(dtype, CustomDtype):
return dtype
elif issubclass(dtype, ctypes._SimpleCData):
# Bypass np.ctypeslib's normalization rules such as
# `np.ctypeslib.as_ctypes_type(ctypes.c_void_p) -> ctypes.c_ulong`
return dtype
Expand Down

0 comments on commit 7e2694e

Please sign in to comment.