fn to_bigint(&self) -> BigInt {
        let sign_bit = self.value.clone() >> (self.bits - 1);
        if sign_bit == BigUint::from_u64(1).unwrap() {
            let mask = BigUint::from_i64(1).unwrap() << self.bits;
            let mask = mask - BigUint::from_i64(1).unwrap();
            let v = self.value.clone() ^ mask;
            let v = v + BigUint::from_u64(1).unwrap();
            BigInt::from_i64(-1).unwrap() * v.to_bigint().unwrap()
        } else {
            self.value.to_bigint().unwrap()
        }
    }
/// Ugly trickery to convert BigUint to BigInt
Ugly trickery to convert BigUint to BigInt
Ugly trickery to convert BigUint to BigInt
fn to_bigint(&self) -> BigInt {
        let sign_bit = self.value.clone() >> (self.bits - 1);
        if sign_bit == BigUint::from_u64(1).unwrap() {
            let mask = BigUint::from_i64(1).unwrap() << self.bits;
            let mask = mask - BigUint::from_i64(1).unwrap();
            let v = self.value.clone() ^ mask;
            let v = v + BigUint::from_u64(1).unwrap();
            BigInt::from_i64(-1).unwrap() * v.to_bigint().unwrap()
        } else {
            self.value.to_bigint().unwrap()
        }
    }
fn to_bigint ( & self ) -> BigInt { let sign_bit = self . value . clone ( ) >> ( self . bits - 1 ) ; if sign_bit == BigUint :: from_u64 ( 1 ) . unwrap ( ) { let mask = BigUint :: from_i64 ( 1 ) . unwrap ( ) << self . bits ; let mask = mask - BigUint :: from_i64 ( 1 ) . unwrap ( ) ; let v = self . value . clone ( ) ^ mask ; let v = v + BigUint :: from_u64 ( 1 ) . unwrap ( ) ; BigInt :: from_i64 ( - 1 ) . unwrap ( ) * v . to_bigint ( ) . unwrap ( ) } else { self . value . to_bigint ( ) . unwrap ( ) } }
Ugly trickery to convert BigUint to BigInt
Ugly trickery to convert BigUint to BigInt
&self
&self