pub fn sign_extend(value: u128, size: Size) -> u128 {
    let size = size.bits();
    // sign extend
    let shift = 128 - size;
    // shift the unsigned value to the left
    // and back to the right as signed (essentially fills with FF on the left)
    (((value << shift) as i128) >> shift) as u128
}
////////////////////////////////////////////////////////////////////////////////
// Methods to facilitate working with signed integers stored in a u128
////////////////////////////////////////////////////////////////////////////////
Methods to facilitate working with signed integers stored in a u128
Methods to facilitate working with signed integers stored in a u128
pub fn sign_extend(value: u128, size: Size) -> u128 {
    let size = size.bits();
    // sign extend
    let shift = 128 - size;
    // shift the unsigned value to the left
    // and back to the right as signed (essentially fills with FF on the left)
    (((value << shift) as i128) >> shift) as u128
}
pub fn sign_extend ( value : u128 , size : Size ) -> u128 { let size = size . bits ( ) ; // sign extend let shift = 128 - size ; // shift the unsigned value to the left // and back to the right as signed (essentially fills with FF on the left) ( ( ( value << shift ) as i128 ) >> shift ) as u128 }
Methods to facilitate working with signed integers stored in a u128
Methods to facilitate working with signed integers stored in a u128
value
u128
size
Size
value
u128
size
Size