pub fn maybe_from_i64(value: i64, scale_ty: Type) -> Option<SImm7Scaled> {
        assert!(scale_ty == I64 || scale_ty == I32);
        let scale = scale_ty.bytes();
        assert!(scale.is_power_of_two());
        let scale = scale as i64;
        let upper_limit = 63 * scale;
        let lower_limit = -(64 * scale);
        if value >= lower_limit && value <= upper_limit && (value & (scale - 1)) == 0 {
            Some(SImm7Scaled {
                value: value as i16,
                scale_ty,
            })
        } else {
            None
        }
    }
/// Create a SImm7Scaled from a raw offset and the known scale type, if
/// possible.
Create a SImm7Scaled from a raw offset and the known scale type, if
possible.
Create a SImm7Scaled from a raw offset and the known scale type if possible .
pub fn maybe_from_i64(value: i64, scale_ty: Type) -> Option<SImm7Scaled> {
        assert!(scale_ty == I64 || scale_ty == I32);
        let scale = scale_ty.bytes();
        assert!(scale.is_power_of_two());
        let scale = scale as i64;
        let upper_limit = 63 * scale;
        let lower_limit = -(64 * scale);
        if value >= lower_limit && value <= upper_limit && (value & (scale - 1)) == 0 {
            Some(SImm7Scaled {
                value: value as i16,
                scale_ty,
            })
        } else {
            None
        }
    }
pub fn maybe_from_i64 ( value : i64 , scale_ty : Type ) -> Option < SImm7Scaled > { assert ! ( scale_ty I64 scale_ty I32 ) ; let scale = scale_ty . bytes ( ) ; assert ! ( scale is_power_of_two ( ) ) ; let scale = scale as i64 ; let upper_limit = 63 * scale ; let lower_limit = - ( 64 * scale ) ; if value >= lower_limit && value <= upper_limit && ( value & ( scale - 1 ) ) == 0 { Some ( SImm7Scaled { value : value as i16 , scale_ty , } ) } else { None } }
Create a SImm7Scaled from a raw offset and the known scale type, if
possible.
Create a SImm7Scaled from a raw offset and the known scale type if possible .
value
i64
scale_ty
Type
value
i64
scale_ty
Type