nix-dotfiles/pkgs/edit/src/simd/mod.rs
2025-05-23 12:19:11 -04:00

19 lines
433 B
Rust

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//! Provides various high-throughput utilities.
mod memchr2;
mod memrchr2;
mod memset;
pub use memchr2::*;
pub use memrchr2::*;
pub use memset::*;
// Can be replaced with `sub_ptr` once it's stabilized.
#[inline(always)]
unsafe fn distance<T>(hi: *const T, lo: *const T) -> usize {
unsafe { usize::try_from(hi.offset_from(lo)).unwrap_unchecked() }
}