Skip to content

Commit fac87b5

Browse files
Armin BecherArmin Becher
authored andcommitted
style: run cargo fmt
1 parent 607c889 commit fac87b5

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

benches/benchmark.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,22 +65,38 @@ fn criterion_benchmark(c: &mut Criterion) {
6565
let n: usize = 2usize.pow(order as u32);
6666
c.bench_function("fast_hilbert_low", |b| {
6767
b.iter(|| {
68-
black_box(fast_hilbert::xy2h(black_box(xy_low.0), black_box(xy_low.1), black_box(order)));
68+
black_box(fast_hilbert::xy2h(
69+
black_box(xy_low.0),
70+
black_box(xy_low.1),
71+
black_box(order),
72+
));
6973
})
7074
});
7175
c.bench_function("fast_hilbert_high", |b| {
7276
b.iter(|| {
73-
black_box(fast_hilbert::xy2h(black_box(xy_high.0), black_box(xy_high.1), black_box(order)));
77+
black_box(fast_hilbert::xy2h(
78+
black_box(xy_high.0),
79+
black_box(xy_high.1),
80+
black_box(order),
81+
));
7482
})
7583
});
7684
c.bench_function("hilbert_curve_low", |b| {
7785
b.iter(|| {
78-
black_box(hilbert_curve::convert_2d_to_1d(xy_low.0 as usize, xy_low.1 as usize, n));
86+
black_box(hilbert_curve::convert_2d_to_1d(
87+
xy_low.0 as usize,
88+
xy_low.1 as usize,
89+
n,
90+
));
7991
})
8092
});
8193
c.bench_function("hilbert_curve_high", |b| {
8294
b.iter(|| {
83-
black_box(hilbert_curve::convert_2d_to_1d(xy_high.0 as usize, xy_high.1 as usize, n));
95+
black_box(hilbert_curve::convert_2d_to_1d(
96+
xy_high.0 as usize,
97+
xy_high.1 as usize,
98+
n,
99+
));
84100
})
85101
});
86102
c.bench_function("hilbert_2d_low", |b| {

src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ impl Unsigned for u8 {
138138
/// let hilbert = fast_hilbert::xy2h(1u64, 0, 1);
139139
/// assert_eq!(hilbert, 0b11u128);
140140
///```
141-
pub fn xy2h<T: Unsigned>(x: T, y: T, order: u8) -> <T as Unsigned>::Key
142-
{
141+
pub fn xy2h<T: Unsigned>(x: T, y: T, order: u8) -> <T as Unsigned>::Key {
143142
// Mapping from State and coordinates to hilbert states
144143
// SXXXYYY => SHHH
145144
// 8 bit => 8 bit
@@ -211,8 +210,7 @@ pub fn xy2h<T: Unsigned>(x: T, y: T, order: u8) -> <T as Unsigned>::Key
211210
/// assert_eq!(x, 1u64);
212211
/// assert_eq!(y, 0u64);
213212
///```
214-
pub fn h2xy<T: Unsigned>(h: <T as Unsigned>::Key, order: u8) -> (T, T)
215-
{
213+
pub fn h2xy<T: Unsigned>(h: <T as Unsigned>::Key, order: u8) -> (T, T) {
216214
// Mapping from hilbert states to 2D coordinates
217215
// SHHH => SXXXYYY
218216
// 8 bit => 8 bit

0 commit comments

Comments
 (0)