one less step

This commit is contained in:
Quaternions 2024-12-31 16:56:48 -08:00
parent c3e5696a83
commit 65cc20bdf9

View File

@ -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);