Skip to content

Commit 6d9f36f

Browse files
authored
Document the motivation for custom transmute wrappers (#243)
They've grown to be more than just 'bytemuck at home'
1 parent 222ca44 commit 6d9f36f

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

fearless_simd/src/transmute.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,17 @@
11
// Copyright 2026 the Fearless_SIMD Authors
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
33

4-
//! We have bytemuck at home
4+
//! Safe wrappers for SIMD loads/stores and reference casts.
55
//!
6-
//! This all serves a small set of checked transmute and cast functions;
7-
//! if we find this growing in complexity we should probably just use the real bytemuck
6+
//! This fulfills the purpose of both `safe_unaligned_simd` and `bytemuck` crates.
7+
//! The implementation is bytemuck-like, but far smaller than either of those crates,
8+
//! mostly by virtue of supporting less features (e.g. no by-value transmute).
9+
//!
10+
//! Unlike bytemuck, this verifies that sizes match at compile time,
11+
//! so we won't accidentally ship always-panicking code even if it's not covered by tests.
12+
//!
13+
//! It's not possible to get rid of `unsafe` here entirely, even if we were to use external crates,
14+
//! because we need to implement Pod for wrappers like Aligned512 which cannot be safely derived.
815
916
use core::mem::{align_of, size_of};
1017

0 commit comments

Comments
 (0)