Parallel agents movement.

This commit is contained in:
mindv0rtex
2021-02-26 14:19:05 -05:00
parent cbc3fcbe06
commit 241e6ba6bf
5 changed files with 72 additions and 21 deletions

9
src/util.rs Normal file
View File

@@ -0,0 +1,9 @@
#[inline(always)]
pub fn is_power_of_two(x: usize) -> bool {
(x & (x - 1)) == 0
}
#[inline(always)]
pub fn wrap(x: f32, max: f32) -> f32 {
x - max * ((x > max) as i32 as f32 - (x < 0.0_f32) as i32 as f32)
}