Skip to content

Commit a5b1721

Browse files
committed
BUGFIX: Using c_void_p instead of c_ulonglong for void *
- Also removed c_dims assigned to ctypes module
1 parent dd77152 commit a5b1721

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

arrayfire/array.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
from .index import *
1616

1717
def create_array(buf, numdims, idims, dtype):
18-
out_arr = ct.c_longlong(0)
19-
ct.c_dims = dim4(idims[0], idims[1], idims[2], idims[3])
20-
safe_call(clib.af_create_array(ct.pointer(out_arr), ct.c_longlong(buf),\
21-
numdims, ct.pointer(ct.c_dims), dtype))
18+
out_arr = ct.c_void_p(0)
19+
c_dims = dim4(idims[0], idims[1], idims[2], idims[3])
20+
safe_call(clib.af_create_array(ct.pointer(out_arr), ct.c_void_p(buf),
21+
numdims, ct.pointer(c_dims), dtype))
2222
return out_arr
2323

2424
def constant_array(val, d0, d1=None, d2=None, d3=None, dtype=f32):
@@ -29,7 +29,7 @@ def constant_array(val, d0, d1=None, d2=None, d3=None, dtype=f32):
2929
else:
3030
raise TypeError("Invalid dtype")
3131

32-
out = ct.c_longlong(0)
32+
out = ct.c_void_p(0)
3333
dims = dim4(d0, d1, d2, d3)
3434

3535
if isinstance(val, complex):
@@ -187,7 +187,7 @@ def __del__(self):
187187
clib.af_release_array(self.arr)
188188

189189
def device_ptr(self):
190-
ptr = ctypes.c_void_p(0)
190+
ptr = ct.c_void_p(0)
191191
clib.af_get_device_ptr(ct.pointer(ptr), self.arr)
192192
return ptr.value
193193

@@ -445,7 +445,7 @@ def __setitem__(self, key, val):
445445
else:
446446
other_arr = val.arr
447447

448-
out_arr = ct.c_longlong(0)
448+
out_arr = ct.c_void_p(0)
449449
inds = get_indices(key, n_dims)
450450

451451
safe_call(clib.af_assign_gen(ct.pointer(out_arr),\

arrayfire/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@
1111

1212
class base_array(object):
1313
def __init__(self):
14-
self.arr = ct.c_longlong(0)
14+
self.arr = ct.c_void_p(0)

arrayfire/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class features(object):
1414

1515
def __init__(self, num=None):
16-
self.feat = ct.c_longlong(0)
16+
self.feat = ct.c_void_p(0)
1717
if num is not None:
1818
assert(isinstance(num, numbers.Number))
1919
safe_call(clib.af_create_features(ct.pointer(self.feat), ct.c_longlong(num)))

arrayfire/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def slice_to_length(key, dim):
8080
return int(((tkey[1] - tkey[0] - 1) / tkey[2]) + 1)
8181

8282
class uidx(ct.Union):
83-
_fields_ = [("arr", ct.c_longlong),
83+
_fields_ = [("arr", ct.c_void_p),
8484
("seq", seq)]
8585

8686
class index(ct.Structure):

0 commit comments

Comments
 (0)