Skip to content

Commit

Permalink
Remove global use of nextafter or work_share.
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricchevalier19 committed Jun 22, 2022
1 parent eaecd83 commit b043aa2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
17 changes: 9 additions & 8 deletions src/algorithms/hilbert_curve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
//! The complexity of encoding a point is O(order)

use crate::geometry::OrientedBoundingBox;
use crate::nextafter::nextafter;
use crate::Point2D;
use rayon::prelude::*;
use std::fmt;
Expand Down Expand Up @@ -91,7 +92,7 @@ fn segment_to_segment(min: f64, max: f64, order: usize) -> impl Fn(f64) -> u64 {

// Map max to (2**order-1).
while n <= width * f {
f = crate::nextafter(f, 0.0);
f = nextafter(f, 0.0);
}

move |v| {
Expand Down Expand Up @@ -362,13 +363,13 @@ mod tests {
assert_eq!(mapping(7.0), 6);
assert_eq!(mapping(8.0), 7);

assert_eq!(mapping(crate::nextafter(1.0, f64::INFINITY)), 1);
assert_eq!(mapping(crate::nextafter(2.0, f64::INFINITY)), 2);
assert_eq!(mapping(crate::nextafter(3.0, f64::INFINITY)), 3);
assert_eq!(mapping(crate::nextafter(4.0, f64::INFINITY)), 4);
assert_eq!(mapping(crate::nextafter(5.0, f64::INFINITY)), 5);
assert_eq!(mapping(crate::nextafter(6.0, f64::INFINITY)), 6);
assert_eq!(mapping(crate::nextafter(7.0, f64::INFINITY)), 7);
assert_eq!(mapping(nextafter(1.0, f64::INFINITY)), 1);
assert_eq!(mapping(nextafter(2.0, f64::INFINITY)), 2);
assert_eq!(mapping(nextafter(3.0, f64::INFINITY)), 3);
assert_eq!(mapping(nextafter(4.0, f64::INFINITY)), 4);
assert_eq!(mapping(nextafter(5.0, f64::INFINITY)), 5);
assert_eq!(mapping(nextafter(6.0, f64::INFINITY)), 6);
assert_eq!(mapping(nextafter(7.0, f64::INFINITY)), 7);
}

#[test]
Expand Down
3 changes: 0 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ pub use crate::algorithms::*;
pub use crate::geometry::{BoundingBox, Point2D, Point3D, PointND};
pub use crate::real::Real;

// Internal use
use crate::nextafter::nextafter;
use crate::work_share::work_share;
use std::cmp::Ordering;

/// The `Partition` trait allows for partitioning data.
Expand Down

0 comments on commit b043aa2

Please sign in to comment.