one less step
This commit is contained in:
parent
c3e5696a83
commit
65cc20bdf9
@ -1,15 +1,13 @@
|
|||||||
use binrw::{binrw,BinReaderExt,io::TakeSeekExt};
|
use binrw::{binrw,BinReaderExt,io::TakeSeekExt};
|
||||||
|
|
||||||
// the bit chunks are deposited in reverse
|
// the bit chunks are deposited in reverse
|
||||||
fn trey_float(f:f32)->f32{
|
fn trey_float(bits:u32)->f32{
|
||||||
let bits=f.to_bits();
|
|
||||||
let s=bits&1;
|
let s=bits&1;
|
||||||
let e=(bits>>1)&((1<<8)-1);
|
let e=(bits>>1)&((1<<8)-1);
|
||||||
let m=(bits>>(1+8))&((1<<23)-1);
|
let m=(bits>>(1+8))&((1<<23)-1);
|
||||||
f32::from_bits(m|(e<<23)|(s<<31))
|
f32::from_bits(m|(e<<23)|(s<<31))
|
||||||
}
|
}
|
||||||
fn trey_double(f:f64)->f64{
|
fn trey_double(bits:u64)->f64{
|
||||||
let bits=f.to_bits();
|
|
||||||
let s=bits&1;
|
let s=bits&1;
|
||||||
let e=(bits>>1)&((1<<11)-1);
|
let e=(bits>>1)&((1<<11)-1);
|
||||||
let m=(bits>>(1+11))&((1<<52)-1);
|
let m=(bits>>(1+11))&((1<<52)-1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user