some dumb math stuff
This commit is contained in:
1 parent
5f64b55234
commit
ba23e9c0f3
2 files changed
+15
No files matched your search
@@ -175,3 +175,16 @@ fn f32 f32FromString(String s) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
fn inline f32 f32Floor(f32 x) {
|
||||
i32 i = (i32)x; // truncates toward zero
|
||||
return (f32)(i - (x < (f32)i));
|
||||
}
|
||||
|
||||
fn inline u32 u32BadRand(u32 *state) {
|
||||
u32 x = *state;
|
||||
x ^= x << 13;
|
||||
x ^= x >> 17;
|
||||
x ^= x << 5;
|
||||
return *state = x;
|
||||
}
|
||||
Reference in new issue
Block a user