From f0ad108e2cf3e8c755dd28334c4496385fe9d624 Mon Sep 17 00:00:00 2001 From: Mark Florisson Date: Thu, 27 Sep 2012 16:30:14 +0100 Subject: [PATCH] Fix some stuff support casting int <-> pointers in llvm_cbuilder assign ndarray type to fake PyArrays --- builder.py | 5 +++++ shortnames.py | 1 + 2 files changed, 6 insertions(+) diff --git a/builder.py b/builder.py index 2826e1d..4a6f23b 100644 --- a/builder.py +++ b/builder.py @@ -1057,6 +1057,11 @@ class IntegerValue(OperatorMixin): return self._temp(self.parent.builder.sext(self.value, ty)) else: return self._temp(self.parent.builder.trunc(self.value, ty)) + elif _is_pointer(ty) and _is_int(self.type): + return self._temp(self.parent.builder.inttoptr(self.value, ty)) + elif _is_int(ty) and _is_pointer(self.type): + return self._temp(self.parent.builder.ptrtoint(self.value, ty)) + raise CastError(self.type, ty) class RealValue(OperatorMixin): diff --git a/shortnames.py b/shortnames.py index 06221aa..2acd69d 100644 --- a/shortnames.py +++ b/shortnames.py @@ -14,6 +14,7 @@ float = Type.float() double = Type.double() npy_intp = minitypes.npy_intp.to_llvm(numba.decorators.context) +py_ssize_t = minitypes.Py_ssize_t.to_llvm(numba.decorators.context) # pointers