Method and system for dividing a data segment of unknown length into first
and second halves, for example, for interleaving the first and second
halves. Units of the data segment are written into first and second
register files. With respect to the first register file, responsive to
determining that the last unit of the data segment has been written into
the first register file, units of the data segment in the first register
file that are not units of the first half of the data segment are
removed, wherein the first register file stores the first half of the
data segment. With respect to the second register file, responsive to
writing each unit of the data segment into the second register file, data
currently stored in the second register file is adjusted to comprise a
last half of the data so far written into the second register file,
wherein, when the last unit of the data segment has been written into the
second register file, and the data currently stored in the second
register file has been adjusted, the data currently stored in the second
register file comprises the second half of the data segment.