-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* split * value * Rc * split fail * ptr_subset * ptr_subset() * fmt * number
- Loading branch information
1 parent
90358fc
commit 3a04e5d
Showing
5 changed files
with
74 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
mod bit_subset64; | ||
mod const_assert; | ||
mod container; | ||
mod number; | ||
mod object; | ||
mod ptr_subset; | ||
mod string16; | ||
mod value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// compatible with `f64` | ||
pub const INFINITY: u64 = 0x7FF0_0000_0000_0000; | ||
pub const NAN: u64 = 0x7FF8_0000_0000_0000; | ||
pub const NEG_INFINITY: u64 = 0xFFF0_0000_0000_0000; | ||
|
||
#[cfg(test)] | ||
mod test { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_nan() { | ||
assert_eq!(f64::INFINITY.to_bits(), INFINITY); | ||
assert_ne!(f64::NAN, f64::NAN); | ||
assert_eq!(f64::NAN.to_bits(), NAN); | ||
assert_eq!(f64::NEG_INFINITY.to_bits(), NEG_INFINITY); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
use std::marker::PhantomData; | ||
|
||
use crate::{ | ||
bit_subset64::BitSubset64, | ||
container::{Clean, Container}, | ||
}; | ||
|
||
pub struct PtrSubset<T: Clean>(pub BitSubset64, pub PhantomData<T>); | ||
|
||
impl<T: Clean> PtrSubset<T> { | ||
pub fn update<const ADD: bool>(&self, v: u64) { | ||
let v = v & self.0.superposition(); | ||
if v == 0 { | ||
return; | ||
} | ||
unsafe { | ||
Container::update::<ADD>(v as *mut Container<T>); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters