Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ testing = [
]

[dependencies]
radium = "0.7"
radium = "1.1.0"
tap = "1"

[dependencies.funty]
Expand Down
16 changes: 7 additions & 9 deletions src/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,15 @@ macro_rules! element {
}
}

radium::if_atomic!( if atomic($size) {
use core::sync::atomic::$atom;
impl BitElement<$atom> {
/// Creates a new element wrapper from a raw integer.
pub const fn new(elem: $bare) -> Self {
Self {
elem: <$atom>::new(elem),
}
use core::sync::atomic::$atom;
impl BitElement<$atom> where $bare: radium::marker::Atomic {
/// Creates a new element wrapper from a raw integer.
pub const fn new(elem: $bare) -> Self {
Self {
elem: <$atom>::new(elem),
}
}
});
}
)+ };
}

Expand Down
44 changes: 21 additions & 23 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,36 +199,34 @@ store!(usize => BitSafeUsize);
/// Generates `BitStore` implementations for atomic types.
macro_rules! atomic {
($($size:tt, $base:ty => $atom:ident);+ $(;)?) => { $(
radium::if_atomic!(if atomic($size) {
use core::sync::atomic::$atom;
use core::sync::atomic::$atom;

impl BitStore for $atom {
type Mem = $base;
type Access = Self;
type Alias = Self;
type Unalias = Self;
impl BitStore for $atom where $base: radium::marker::Atomic {
type Mem = $base;
type Access = Self;
type Alias = Self;
type Unalias = Self;

const ZERO: Self = <Self>::new(0);
const ZERO: Self = <Self>::new(0);

#[inline]
fn new(value: Self::Mem) -> Self { <Self>::new(value) }
#[inline]
fn new(value: Self::Mem) -> Self { <Self>::new(value) }

#[inline]
fn load_value(&self) -> Self::Mem {
self.load(core::sync::atomic::Ordering::Relaxed)
}
#[inline]
fn load_value(&self) -> Self::Mem {
self.load(core::sync::atomic::Ordering::Relaxed)
}

#[inline]
fn store_value(&mut self, value: Self::Mem) {
*self = Self::new(value);
}
#[inline]
fn store_value(&mut self, value: Self::Mem) {
*self = Self::new(value);
}

const ALIGNED_TO_SIZE: [(); 1]
= [(); mem::aligned_to_size::<Self>() as usize];
const ALIGNED_TO_SIZE: [(); 1]
= [(); mem::aligned_to_size::<Self>() as usize];

const ALIAS_WIDTH: [(); 1] = [()];
}
});
const ALIAS_WIDTH: [(); 1] = [()];
}
)+ };
}

Expand Down