///|
/// Copy `length` bytes between FixedArray[Byte] buffers.
/// Safe for overlapping regions within the same array.
pub fn blit_fixed_array(
dst : FixedArray[Byte],
dst_offset : Int,
src : FixedArray[Byte],
src_offset : Int,
length : Int,
) -> Unit {
FixedArray::unsafe_blit(dst, dst_offset, src, src_offset, length)
}
///|
/// Copy `length` bytes from `src` (Bytes) at `src_offset` into `dst` (FixedArray) at `dst_offset`.
pub fn blit_bytes(
dst : FixedArray[Byte],
dst_offset : Int,
src : Bytes,
src_offset : Int,
length : Int,
) -> Unit {
dst.blit_from_bytes(dst_offset, src, src_offset, length)
}
///|
/// Fill `length` bytes in `dst` starting at `dst_offset` with `value`.
pub fn fill_bytes(
dst : FixedArray[Byte],
dst_offset : Int,
value : Byte,
length : Int,
) -> Unit {
for i in 0.. Int {
let mut i = 0
while i < max_len && a[a_offset + i] == b[b_offset + i] {
i += 1
}
i
}
///|
/// Word-at-a-time match length comparison on Bytes (byte-by-byte fallback for non-native).
pub fn match_length_bytes(
a : Bytes,
a_offset : Int,
b : Bytes,
b_offset : Int,
max_len : Int,
) -> Int {
let mut i = 0
while i < max_len && a[a_offset + i] == b[b_offset + i] {
i += 1
}
i
}
///|
/// Subtract `delta` from each of `len` elements, clamping to `floor`.
pub fn shift_int_array(
arr : FixedArray[Int],
len : Int,
delta : Int,
floor : Int,
) -> Unit {
for i in 0.. FixedArray[Byte] {
FixedArray::make(len, b'\x00')
}
///|
pub fn make_uninit_int(len : Int) -> FixedArray[Int] {
FixedArray::make(len, 0)
}
///|
pub fn make_uninit_uint(len : Int) -> FixedArray[UInt] {
FixedArray::make(len, 0U)
}