replace a byte of a long
Bobb Fwed
Posts: 1,119
I was trying to think of an easy way to replace a single byte of a long, but I didn't get much sleep last night, so I am stuck with this solution:
There's got to be an easier way that I am just blind to because of lack of beauty sleep.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 8/6/2009 3:59:27 PM GMT
'' switching out byte[noparse][[/noparse] 2 ] byte := $80 long := (long & $FF_00_FF_FF) | (byte << 16)
There's got to be an easier way that I am just blind to because of lack of beauty sleep.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 8/6/2009 3:59:27 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
can a byte (or word) be extracted/changed from a long?
Or, alternatively, will two declared variables in a method (PUB Main | v1, v2) always be next to each other in hub memory (i.e. I could just store my information to two adjacent variables rather than an array)?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
out will be $56_67
EDIT: fixed typo and formatting issue
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
April, 2008: when I discovered the answers to all my micro-computational-botherations!
Post Edited (Bobb Fwed) : 8/6/2009 7:05:26 PM GMT