hex: make wraparound of the index into ring-buffer explicit