forked from JuliaLang/julia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmem.jl
57 lines (41 loc) · 1.43 KB
/
cmem.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# This file is a part of Julia. License is MIT: https://julialang.org/license
"""
memcpy(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid}
Call `memcpy` from the C standard library.
!!! compat "Julia 1.10"
Support for `memcpy` requires at least Julia 1.10.
"""
function memcpy(dst::Ptr, src::Ptr, n::Integer)
@_terminates_globally_meta
ccall(:memcpy, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), dst, src, n)
end
"""
memmove(dst::Ptr, src::Ptr, n::Integer) -> Ptr{Cvoid}
Call `memmove` from the C standard library.
!!! compat "Julia 1.10"
Support for `memmove` requires at least Julia 1.10.
"""
function memmove(dst::Ptr, src::Ptr, n::Integer)
@_terminates_globally_meta
ccall(:memmove, Ptr{Cvoid}, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), dst, src, n)
end
"""
memset(dst::Ptr, val, n::Integer) -> Ptr{Cvoid}
Call `memset` from the C standard library.
!!! compat "Julia 1.10"
Support for `memset` requires at least Julia 1.10.
"""
function memset(p::Ptr, val, n::Integer)
@_terminates_globally_meta
ccall(:memset, Ptr{Cvoid}, (Ptr{Cvoid}, Cint, Csize_t), p, val, n)
end
"""
memcmp(a::Ptr, b::Ptr, n::Integer) -> Int
Call `memcmp` from the C standard library.
!!! compat "Julia 1.10"
Support for `memcmp` requires at least Julia 1.9.
"""
function memcmp(a::Ptr, b::Ptr, n::Integer)
@_terminates_globally_meta
ccall(:memcmp, Cint, (Ptr{Cvoid}, Ptr{Cvoid}, Csize_t), a, b, n % Csize_t) % Int
end