Skip to content

Commit

Permalink
add doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Yu-zh authored and bobzhang committed Dec 3, 2024
1 parent 180fedd commit 156688f
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions builtin/fixedarray_block.mbt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@
// limitations under the License.

///|
/// Copies a slice of elements from one fixed array to another.
///
/// This function copies `len` elements from `src` starting at `src_offset` to `dst` starting at `dst_offset`.
/// The arrays may overlap, in which case the copy is performed in a way that preserves the data.
///
/// # Example
/// ```
/// let src = FixedArray::from_array([1, 2, 3, 4, 5])
/// let dst = FixedArray::from_array([0, 0, 0, 0, 0])
/// FixedArray::unsafe_blit(dst, 0, src, 0, 3)
/// assert_eq!(dst, FixedArray::from_array([1, 2, 3, 0, 0]))
/// ```
///
/// The behavior is undefined and platform-specific if:
/// - `len < 0`
/// - `src_offset < 0`
/// - `dst_offset < 0`
/// - `dst_offset + len > dst.length()`
/// - `src_offset + len > src.length()`
///
/// @intrinsic %fixedarray.copy
pub fn FixedArray::unsafe_blit[A](
dst : FixedArray[A],
Expand Down

0 comments on commit 156688f

Please sign in to comment.