pub fn sign_extend(word: u32, topbit: usize, size: usize) -> u64 {
    if word & (1 << topbit) == (1 << topbit) {
        return u64::from(word) | ((1_u64 << (size - topbit)) - 1) << topbit;
    }
    u64::from(word)
}
///
/// Sign extend a u32 value, with given topbit to u64 value
///
Sign extend a u32 value, with given topbit to u64 value
Sign extend a u32 value with given topbit to u64 value
pub fn sign_extend(word: u32, topbit: usize, size: usize) -> u64 {
    if word & (1 << topbit) == (1 << topbit) {
        return u64::from(word) | ((1_u64 << (size - topbit)) - 1) << topbit;
    }
    u64::from(word)
}
pub fn sign_extend ( word : u32 , topbit : usize , size : usize ) -> u64 { if word & ( 1 << topbit ) == ( 1 << topbit ) { return u64 :: from ( word ) | ( ( 1_u64 << ( size - topbit ) ) - 1 ) << topbit ; } u64 :: from ( word ) }
Sign extend a u32 value, with given topbit to u64 value
Sign extend a u32 value with given topbit to u64 value
word
u32
topbit
usize
size
usize
word
u32
topbit
usize
size
usize