1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
move_counter = (from, to) { for i in 16..0 { x = 2^i -> if from >= x { from -= x to += x } } } add = (c1, c2) { out = counter() move_counter(c1, out) move_counter(c2, out) }