Skip to main content

add

Function add 

Source
fn add(left: &Compressed, right: &Compressed) -> [i32; 32]
Expand description

Add two snailfish numbers.

The initial step creates a new root node then makes the numbers the left and right children of this new root node, by copying the respective ranges of the implicit trees.

We can optimize the rules a little; the first round of explode was already done in creating compressed arguments, and a split runs its own inline explode.