fn add(self, rhs: BigInt) -> Self::Output {
        // We know that the result will be *at least* as long as the longer of the two operands,
        // so we can create a vector with sufficient capacity to avoid expensive reallocations.
        let max_len = cmp::max(self.data.len(), rhs.data.len());
        let mut result_vec:Vec<u64> = Vec::with_capacity(max_len);
        let mut carry = false; /* the current carry bit */
        for i in 0..max_len {
            let lhs_val = if i < self.data.len() { self.data[i] } else { 0 };
            let rhs_val = if i < rhs.data.len() { rhs.data[i] } else { 0 };
            // Compute next digit and carry. Then, store the digit for the result, and the carry for later.
            unimplemented!()
        }
        // **Exercise 08.2**: Handle the final `carry`, and return the sum.
        unimplemented!()
    }
// Now we can write the actual function performing the addition.
Now we can write the actual function performing the addition.
Now we can write the actual function performing the addition .
fn add(self, rhs: BigInt) -> Self::Output {
        // We know that the result will be *at least* as long as the longer of the two operands,
        // so we can create a vector with sufficient capacity to avoid expensive reallocations.
        let max_len = cmp::max(self.data.len(), rhs.data.len());
        let mut result_vec:Vec<u64> = Vec::with_capacity(max_len);
        let mut carry = false; /* the current carry bit */
        for i in 0..max_len {
            let lhs_val = if i < self.data.len() { self.data[i] } else { 0 };
            let rhs_val = if i < rhs.data.len() { rhs.data[i] } else { 0 };
            // Compute next digit and carry. Then, store the digit for the result, and the carry for later.
            unimplemented!()
        }
        // **Exercise 08.2**: Handle the final `carry`, and return the sum.
        unimplemented!()
    }
fn add ( self , rhs : BigInt ) -> Self :: Output { // We know that the result will be *at least* as long as the longer of the two operands, // so we can create a vector with sufficient capacity to avoid expensive reallocations. let max_len = cmp :: max ( self . data . len ( ) , rhs . data . len ( ) ) ; let mut result_vec : Vec < u64 > = Vec :: with_capacity ( max_len ) ; let mut carry = false ; /* the current carry bit */ for i in 0 .. max_len { let lhs_val = if i < self . data . len ( ) { self . data [ i ] } else { 0 } ; let rhs_val = if i < rhs . data . len ( ) { rhs . data [ i ] } else { 0 } ; // Compute next digit and carry. Then, store the digit for the result, and the carry for later. unimplemented ! ( ) } // **Exercise 08.2**: Handle the final `carry`, and return the sum. unimplemented ! ( ) }
Now we can write the actual function performing the addition.
Now we can write the actual function performing the addition .
self
rhs
BigInt
self
rhs
BigInt