pub(crate) fn add(a: &[i8], b: &[i8]) -> Vec<i8> {
    let mut out = vec![0; cmp::max(a.len(), b.len())];
    let mut carry = 0;
    let mut a_i: i8;
    let mut b_i: i8;

    for i in 0..out.len() {
        a_i = if i < a.len() { a[i] } else { 0 };
        b_i = if i < b.len() { b[i] } else { 0 };
        let f_a = full_add(a_i, b_i, carry);
        out[i] = f_a.0;
        carry = f_a.1;
    }

    out
}
/// Adds two slices of trits and returns the result
Adds two slices of trits and returns the result
Adds two slices of trits and returns the result
pub(crate) fn add(a: &[i8], b: &[i8]) -> Vec<i8> {
    let mut out = vec![0; cmp::max(a.len(), b.len())];
    let mut carry = 0;
    let mut a_i: i8;
    let mut b_i: i8;
    for i in 0..out.len() {
        a_i = if i < a.len() { a[i] } else { 0 };
        b_i = if i < b.len() { b[i] } else { 0 };
        let f_a = full_add(a_i, b_i, carry);
        out[i] = f_a.0;
        carry = f_a.1;
    }
    out
}
pub ( crate ) fn add ( a : & [ i8 ] , b : & [ i8 ] ) -> Vec < i8 > { let mut out = vec ! [ 0 cmp max ( a len ( ) b len ( ) ) ] ; let mut carry = 0 ; let mut a_i : i8 ; let mut b_i : i8 ; for i in 0 .. out . len ( ) { a_i = if i < a . len ( ) { a [ i ] } else { 0 } ; b_i = if i < b . len ( ) { b [ i ] } else { 0 } ; let f_a = full_add ( a_i , b_i , carry ) ; out [ i ] = f_a . 0 ; carry = f_a . 1 ; } out }
Adds two slices of trits and returns the result
Adds two slices of trits and returns the result
a
&[i8]
b
&[i8]