From 65cc20bdf99f07b3c6e0d82ff0c3f8c3cb904581 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 31 Dec 2024 16:56:48 -0800 Subject: [PATCH] one less step --- src/v1.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/v1.rs b/src/v1.rs index 621ba29..b341c0d 100644 --- a/src/v1.rs +++ b/src/v1.rs @@ -1,15 +1,13 @@ use binrw::{binrw,BinReaderExt,io::TakeSeekExt}; // the bit chunks are deposited in reverse -fn trey_float(f:f32)->f32{ - let bits=f.to_bits(); +fn trey_float(bits:u32)->f32{ let s=bits&1; let e=(bits>>1)&((1<<8)-1); let m=(bits>>(1+8))&((1<<23)-1); f32::from_bits(m|(e<<23)|(s<<31)) } -fn trey_double(f:f64)->f64{ - let bits=f.to_bits(); +fn trey_double(bits:u64)->f64{ let s=bits&1; let e=(bits>>1)&((1<<11)-1); let m=(bits>>(1+11))&((1<<52)-1);