axhash-core 1.0.0

Platform-agnostic AxHash core for Rust with no_std compatibility.
Documentation
#[inline(always)]
pub(crate) unsafe fn r_u64(ptr: *const u8) -> u64 {
    // SAFETY: The caller guarantees ptr points to at least 8 valid bytes.
    unsafe { u64::from_le(core::ptr::read_unaligned(ptr.cast::<u64>())) }
}

#[cfg(target_arch = "aarch64")]
use core::arch::aarch64::{uint64x2_t, vld1q_u64};

#[cfg(target_arch = "aarch64")]
#[target_feature(enable = "neon")]
pub(crate) unsafe fn r_u64x2(ptr: *const u8) -> uint64x2_t {
    // SAFETY: The caller guarantees ptr points to at least 16 valid bytes.
    unsafe { vld1q_u64(ptr.cast::<u64>()) }
}

#[cfg(target_arch = "aarch64")]
#[target_feature(enable = "neon")]
pub(crate) unsafe fn r_u64x2_aligned(ptr: *const u64) -> uint64x2_t {
    // SAFETY: The caller guarantees ptr is u64-aligned and points to at least 2 valid u64.
    unsafe { vld1q_u64(ptr) }
}