Skip to content

Commit

Permalink
remove unsafe call (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moelf authored Oct 10, 2024
1 parent f9032bd commit ba9ef0e
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/all_implementations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5483,7 +5483,7 @@ function from_buffers(
end
form_mask = form["mask"]

excess_length = Int64(ceil(length / 8.0))
excess_length = div(length, 8, RoundUp)

mask_buffer = _get_buffer(form_key, "mask", buffer_key, containers)
raw_mask = _get_index(form_mask, excess_length, mask_buffer)
Expand Down Expand Up @@ -5511,11 +5511,8 @@ function from_buffers(
end

mask = falses(length)
unsafe_copyto!(
reinterpret(Ptr{UInt8}, pointer(mask.chunks)),
pointer(raw_mask),
excess_length,
)
mask_chunks_bytes = reinterpret(UInt8, mask.chunks)
copyto!(mask_chunks_bytes, firstindex(mask_chunks_bytes), raw_mask, firstindex(raw_mask), excess_length)

if !lsb_order
mask.len = excess_length * 8
Expand Down

0 comments on commit ba9ef0e

Please sign in to comment.