libmhash 0.2.1

A file hashing library that can do multiple hashes for multile files at the same time.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use std::slice;

#[inline(always)]
pub(super) fn slice_as_chunks<T, const N: usize>(slice: &[T]) -> &[[T; N]] {
    debug_assert_eq!(slice.len() % N, 0);
    unsafe { slice::from_raw_parts(slice.as_ptr().cast(), slice.len() / N) }
}

#[inline(always)]
pub(super) fn slice_as_chunks_mut<T, const N: usize>(slice: &mut [T]) -> &mut [[T; N]] {
    debug_assert_eq!(slice.len() % N, 0);
    unsafe { slice::from_raw_parts_mut(slice.as_mut_ptr().cast(), slice.len() / N) }
}