Skip to content

Commit 4a3b74b

Browse files
committed
Make structs repr(transparent)
Fixes #44
1 parent 30179f8 commit 4a3b74b

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const CANONICAL_ZERO_BITS: u64 = 0x0u64;
4242
/// NaN is sorted as *greater* than all other values and *equal*
4343
/// to itself, in contradiction with the IEEE standard.
4444
#[derive(Debug, Default, Clone, Copy)]
45+
#[repr(transparent)]
4546
pub struct OrderedFloat<T: Float>(pub T);
4647

4748
impl<T: Float> OrderedFloat<T> {
@@ -170,6 +171,7 @@ impl<T: Float> Bounded for OrderedFloat<T> {
170171
///
171172
/// A NaN value cannot be stored in this type.
172173
#[derive(PartialOrd, PartialEq, Debug, Default, Clone, Copy)]
174+
#[repr(transparent)]
173175
pub struct NotNan<T: Float>(T);
174176

175177
impl<T: Float> NotNan<T> {

0 commit comments

Comments
 (0)