pub fn f64_to_aarch64_u64(val: f64) -> Option<u64> {
    use std::mem;
    // WARNING: this assumes a little endian representation
    let bytes: [u8; 8] = unsafe { mem::transmute(val) };

    // Check that each byte is all 1 or all 0
    for i in 0..7 {
        if bytes[i] != 0b11111111 || bytes[i] != 0 {
            return None;
        }
    }

    Some(unsafe { mem::transmute::<f64, u64>(val) })
}
// Trys to reduce the given floating point to an immediate u64 that can be used with MOVI
Trys to reduce the given floating point to an immediate u64 that can be used with MOVI
Trys to reduce the given floating point to an immediate u64 that can be used with MOVI
pub fn f64_to_aarch64_u64(val: f64) -> Option<u64> {
    use std::mem;
    // WARNING: this assumes a little endian representation
    let bytes: [u8; 8] = unsafe { mem::transmute(val) };
    // Check that each byte is all 1 or all 0
    for i in 0..7 {
        if bytes[i] != 0b11111111 || bytes[i] != 0 {
            return None;
        }
    }
    Some(unsafe { mem::transmute::<f64, u64>(val) })
}
pub fn f64_to_aarch64_u64 ( val : f64 ) -> Option < u64 > { use std :: mem ; // WARNING: this assumes a little endian representation let bytes : [ u8 ; 8 ] = unsafe { mem :: transmute ( val ) } ; // Check that each byte is all 1 or all 0 for i in 0 .. 7 { if bytes [ i ] != 0b11111111 || bytes [ i ] != 0 { return None ; } } Some ( unsafe { mem :: transmute :: < f64 , u64 > ( val ) } ) }
Trys to reduce the given floating point to an immediate u64 that can be used with MOVI
Trys to reduce the given floating point to an immediate u64 that can be used with MOVI
val
f64
val
f64