Skip to content

Commit ba9ef0e

Browse files
authored
remove unsafe call (#110)
1 parent f9032bd commit ba9ef0e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/all_implementations.jl

+3-6
Original file line numberDiff line numberDiff line change
@@ -5483,7 +5483,7 @@ function from_buffers(
54835483
end
54845484
form_mask = form["mask"]
54855485

5486-
excess_length = Int64(ceil(length / 8.0))
5486+
excess_length = div(length, 8, RoundUp)
54875487

54885488
mask_buffer = _get_buffer(form_key, "mask", buffer_key, containers)
54895489
raw_mask = _get_index(form_mask, excess_length, mask_buffer)
@@ -5511,11 +5511,8 @@ function from_buffers(
55115511
end
55125512

55135513
mask = falses(length)
5514-
unsafe_copyto!(
5515-
reinterpret(Ptr{UInt8}, pointer(mask.chunks)),
5516-
pointer(raw_mask),
5517-
excess_length,
5518-
)
5514+
mask_chunks_bytes = reinterpret(UInt8, mask.chunks)
5515+
copyto!(mask_chunks_bytes, firstindex(mask_chunks_bytes), raw_mask, firstindex(raw_mask), excess_length)
55195516

55205517
if !lsb_order
55215518
mask.len = excess_length * 8

0 commit comments

Comments
 (0)