atomic-maybe-uninit 0.1.0

Atomic operations on potentially uninitialized integers.
Documentation
atomic-maybe-uninit-0.1.0 has been yanked.

atomic-maybe-uninit

crates.io docs.rs license rustc build status

Atomic operations on potentially uninitialized integers.

Motivation

Copying types containing uninitialized bytes (e.g., padding), via the standard library's atomic types is undefined behavior because the copy goes through integers.

This crate provides a way to soundly perform such operations.

Platform Support

Currently, x86, x86_64, and RISC-V are supported.

target_arch primitives load store swap
x86 isize,usize,i8,u8,i16,u16,i32,u32
x86_64 isize,usize,i8,u8,i16,u16,i32,u32,i64,u64
riscv32 isize,usize,i32,u32 ✓*
riscv32 i8,u8,i16,u16
riscv64 isize,usize,i32,u32,i64,u64 ✓*
riscv64 i8,u8,i16,u16

* RISC-V's atomic swap requires the A extension.

Feel free to submit an issue if your target is not supported yet.

Related Projects

  • portable-atomic: Portable atomic types including extensions such as 128-bit atomics, atomic float, etc.
  • atomic-memcpy: Byte-wise atomic memcpy.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.