Skip to content

Commit 9155a8c

Browse files
authored
Delay conversions to Int in pointer intrinsics. (#268)
1 parent 0e38b16 commit 9155a8c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/interop/pointer.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export @typed_ccall
66

77
using Core: LLVMPtr
88

9-
@generated function pointerref(ptr::LLVMPtr{T,A}, i::Int, ::Val{align}) where {T,A,align}
9+
@generated function pointerref(ptr::LLVMPtr{T,A}, i::Integer, ::Val{align}) where {T,A,align}
1010
sizeof(T) == 0 && return T.instance
1111
Context() do ctx
1212
eltyp = convert(LLVMType, T; ctx)
@@ -41,7 +41,7 @@ using Core: LLVMPtr
4141
end
4242
end
4343

44-
@generated function pointerset(ptr::LLVMPtr{T,A}, x::T, i::Int, ::Val{align}) where {T,A,align}
44+
@generated function pointerset(ptr::LLVMPtr{T,A}, x::T, i::Integer, ::Val{align}) where {T,A,align}
4545
sizeof(T) == 0 && return
4646
Context() do ctx
4747
eltyp = convert(LLVMType, T; ctx)
@@ -79,10 +79,10 @@ end
7979
end
8080

8181
Base.unsafe_load(ptr::Core.LLVMPtr, i::Integer=1, align::Val=Val(1)) =
82-
pointerref(ptr, Int(i), align)
82+
pointerref(ptr, i, align)
8383

8484
Base.unsafe_store!(ptr::Core.LLVMPtr{T}, x, i::Integer=1, align::Val=Val(1)) where {T} =
85-
pointerset(ptr, convert(T, x), Int(i), align)
85+
pointerset(ptr, convert(T, x), i, align)
8686

8787

8888
# pointer operations

0 commit comments

Comments
 (0)