/// Compute a Imm12 from raw bits, if possible.
Compute a Imm12 from raw bits, if possible.
Compute a Imm12 from raw bits if possible .
pub fn maybe_from_u64(val: u64) -> Option<Imm12> {
        if val == 0 {
            Some(Imm12 {
                bits: 0,
                shift12: false,
            })
        } else if val < 0xfff {
            Some(Imm12 {
                bits: val as usize,
                shift12: false,
            })
        } else if val < 0xfff_000 && (val & 0xfff == 0) {
            Some(Imm12 {
                bits: (val as usize) >> 12,
                shift12: true,
            })
        } else {
            None
        }
    }
pub fn maybe_from_u64 ( val : u64 ) -> Option < Imm12 > { if val == 0 { Some ( Imm12 { bits : 0 , shift12 : false , } ) } else if val < 0xfff { Some ( Imm12 { bits : val as usize , shift12 : false , } ) } else if val < 0xfff_000 && ( val & 0xfff == 0 ) { Some ( Imm12 { bits : ( val as usize ) >> 12 , shift12 : true , } ) } else { None } }
Compute a Imm12 from raw bits, if possible.
Compute a Imm12 from raw bits if possible .
val
u64