You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: legacy.rs
    path of file: ./repos/rust-decimal/src/ops
    
    the code of the file until where you have to start completion: use crate::{
    constants::{MAX_PRECISION_U32, POWERS_10, U32_MASK},
    decimal::{CalculationResult, Decimal},
    ops::array::{
        add_by_internal, cmp_internal, div_by_u32, is_all_zero, mul_by_u32, mul_part, rescale_internal, shl1_internal,
    },
};

use core::cmp::Ordering;
use num_traits::Zero;

pub(crate) fn add_impl(d1: &Decimal, d2: &Decimal) -> CalculationResult {
    // Convert to the same scale
    let mut my = d1.mantissa_array3();
    let mut my_scale = d1.scale();
    let mut ot = d2.mantissa_array3();
    let mut other_scale = d2.scale();
    rescale_to_maximum_scale(&mut my, &mut my_scale, &mut ot, &mut other_scale);
    let mut final_scale = my_scale.max(o
    
fn rescale_to_maximum_scale(left: &mut [u32; 3], left_scale: &mut u32, right: &mut [u32; 3], right_scale: &mut u32) {
    if left_scale == right_scale {
        // Nothing to do
        return;
    }

    if is_all_zero(left) {
        *left_scale = *right_scale;
        return;
    } else if is_all_zero(right) {
        *right_scale = *left_scale;
        return;
    }

    if left_scale > right_scale {
        rescale_internal(right, right_scale, *left_scale);
        if right_scale != left_scale {
            rescale_internal(left, left_scale, *right_scale);
        }
    } else {
        rescale_internal(left, left_scale, *right_scale);
        if right_scale != left_scale {
            rescale_internal(right, right_scale, *left_scale);
        }
    }
}