Removed branching

This commit is contained in:
MaxOhn
2021-01-08 12:26:59 +01:00
parent 0d72f28fc7
commit 238e33c660
9 changed files with 21 additions and 42 deletions
+1
View File
@@ -112,6 +112,7 @@ mod tests {
let margin = 0.005;
#[rustfmt::skip]
// TODO: More mods
let data = vec![
(1851299, 1 << 8, 4.23514130038547), // HT
(1851299, 0, 5.356786475158158), // NM
+1 -5
View File
@@ -90,11 +90,7 @@ pub(crate) fn point_at_distance(array: &[Pos2], distance: f32) -> Pos2 {
let angle = angle_from_points(array[i], array[i + 1]);
let cart = cart_from_pol(distance - current_distance, angle);
if array[i].x > array[i + 1].x {
array[i] - cart
} else {
array[i] + cart
}
array[i] + cart * ((array[i].x <= array[i + 1].x) as i8 * 2 - 1) as f32
}
}
+5 -4
View File
@@ -1,3 +1,5 @@
#![allow(unused)]
use super::curve::Curve;
use parse::{Beatmap, BeatmapAttributes, HitObject, HitObjectKind, PathType, Pos2};
@@ -315,10 +317,9 @@ impl SliderTick {
}
}
use std::fmt;
impl fmt::Debug for SliderTick {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
// TODO: Remove
impl std::fmt::Debug for SliderTick {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{{pos={:?} | time={}}}", self.pos, self.time)
}
}