I have a data structure:
data = array of integer;
I have filled it from an
source = array of byte;
with>
You can do this in a one-liner using Move.
Move(source[0], dest[0], Length(source)*SizeOf(source[0]));
If you need to perform a network/host byte order transformation, then you can run across the integer array after the Move
.
In the opposite direction you do it all in reverse.
If you haven't got byte order issues then you might not actually need to convert to a byte array at all. It's possible that you can use the integer array as is. Remember that, without byte order issues, the memory layout of the byte and integer arrays are the same (which is why you are able to blit with Move
).