Uses ptrdiff_t when addressing the segment vector.

This ensures to not overflow the 32 bit index.
Note anyway that at now we dont support so many elements.