Isn't `i` at the end just `addr.len() - 1` ?