copy byte array to long array
pgbpsu
Posts: 460
I have a byte-wise array in HUB memory that I'd like to copy over to a long-wise array. I've been reading the Prop Manual (pg 209 in the printed version) and I'm still unsure how how to correctly copy all the data from one location to the other. As bytes of data become available from my input, I put them into byteArray. At some point I want to copy everything in byteArray over to longArray.
Are any of these correct? If not, how does one move bytes from a byte array to a long array?
Seems like I should have run into this before or see a post on this, but I haven't and my searches didn't turn up anything (had to use parallax search because my parallax google search no longer works).
Thanks,
Peter
VAR byte byteArray[noparse][[/noparse]10*4] long longArray[noparse][[/noparse]10] PUB ' copy from one location to the other using bytemove bytemove(@longArray[noparse][[/noparse]0],@byteArray[noparse][[/noparse]0],4*10) ' move all the bytes using bytemove 'OR longmove(@longArray[noparse][[/noparse]0],@byteArray[noparse][[/noparse]0],10) ' move all longs using longmove 'However, looking at pg 209 and 168 makes me think I SHOULD use something like this: bytemove(@longArray.byte,@byteArray[noparse][[/noparse]0],4*10)
Are any of these correct? If not, how does one move bytes from a byte array to a long array?
Seems like I should have run into this before or see a post on this, but I haven't and my searches didn't turn up anything (had to use parallax search because my parallax google search no longer works).
Thanks,
Peter
Comments
If in fact you want byte 0 to end up in long 0, byte 1 to end up in long 1, etc., you're going to have to use a loop.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon McPhalen
Hollywood, CA
byteArray[noparse][[/noparse]0] = 0x01
byteArray = 0x23
byteArray = 0x45
byteArray = 0x67
I'd like longArray[noparse][[/noparse]0] = 0x0123_4567
p