Assigning byte variable from a long/word value?
kwagner
Posts: 48
I have some network stuff I'm doing as byte arrays, and I need to fill in some of them with values I'm getting from words. Do I need to bother doing the following:
a[0] := (b>>8)&$FF
a[1] := b&$FF
Or does it only copy the bottom 8 bits regardless, in which case the &$FF is wasted cycles?
Comments
if a is an array of bytes, then any simple assignments to it will be truncated to 8 bits.
I double-checked with this bit of code:
This was the output:
Thanks, that's great!