Skip to content

Commit 3c6c47c

Browse files
committed
BUGFIX: Fixing the bug in constant for 64 bit int types
1 parent a6d7863 commit 3c6c47c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arrayfire/array.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ def constant_array(val, d0, d1=None, d2=None, d3=None, dtype=Dtype.f32):
8585
safe_call(backend.get().af_constant_complex(ct.pointer(out), c_real, c_imag,
8686
4, ct.pointer(dims), dtype))
8787
elif dtype.value == Dtype.s64.value:
88-
c_val = c_dim_t(val.real)
88+
c_val = ct.c_longlong(val.real)
8989
safe_call(backend.get().af_constant_long(ct.pointer(out), c_val, 4, ct.pointer(dims)))
9090
elif dtype.value == Dtype.u64.value:
91-
c_val = c_dim_t(val.real)
91+
c_val = ct.c_ulonglong(val.real)
9292
safe_call(backend.get().af_constant_ulong(ct.pointer(out), c_val, 4, ct.pointer(dims)))
9393
else:
9494
c_val = ct.c_double(val)

arrayfire/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def dim4(d0=1, d1=1, d2=1, d3=1):
1515
out = c_dim4(1, 1, 1, 1)
1616

1717
for i, dim in enumerate((d0, d1, d2, d3)):
18-
if (dim is not None): out[i] = dim
18+
if (dim is not None): out[i] = c_dim_t(dim)
1919

2020
return out
2121

0 commit comments

Comments
 (0)