Even if length is guaranteed bigger than 2, what is the point of not simply doing `size_t i = r.length / 2` ? Am I missing something?

This will also fail if `length > size_t.max / 2`, due to the the signed division. Such length are not impossible on a 32 bit build.