Skip to content

Commit

Permalink
Replace length(m)*sizeof(eltype(m)) with sizeof(m)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmert committed Sep 5, 2020
1 parent f61c40b commit 2f6c1f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions stdlib/Mmap/src/Mmap.jl
Original file line number Diff line number Diff line change
Expand Up @@ -335,10 +335,10 @@ const MS_SYNC = 4
Forces synchronization between the in-memory version of a memory-mapped `Array` or
[`BitArray`](@ref) and the on-disk version.
"""
function sync!(m::Array{T}, flags::Integer=MS_SYNC) where T
function sync!(m::Array, flags::Integer=MS_SYNC)
offset = rem(UInt(pointer(m)), PAGESIZE)
ptr = pointer(m) - offset
mmaplen = length(m) * sizeof(T) + offset
mmaplen = sizeof(m) + offset
GC.@preserve m @static if Sys.isunix()
systemerror("msync",
ccall(:msync, Cint, (Ptr{Cvoid}, Csize_t, Cint), ptr, mmaplen, flags) != 0)
Expand Down Expand Up @@ -397,10 +397,10 @@ end
Advises the kernel on the intended usage of the memory-mapped `array`, with the intent
`flag` being one of the available `MADV_*` constants.
"""
function madvise!(m::Array{T}, flag::Integer=MADV_NORMAL) where T
function madvise!(m::Array, flag::Integer=MADV_NORMAL)
offset = rem(UInt(pointer(m)), PAGESIZE)
ptr = pointer(m) - offset
mmaplen = length(m) * sizeof(T) + offset
mmaplen = sizeof(m) + offset
GC.@preserve m begin
systemerror("madvise",
ccall(:madvise, Cint, (Ptr{Cvoid}, Csize_t, Cint), ptr, mmaplen, flag) != 0)
Expand Down

0 comments on commit 2f6c1f4

Please sign in to comment.