Bit fill in PASM?
Drone
Posts: 433
I have a long in a speed critical PASM program. If the value of the long is $00_00_00_00 I want it to stay that way. If the long is $00_00_00_01 I want to fill the LSByte with ones, so $00_00_00_01 maps to $00_00_00_FF. The values o of the long will only ever start with $00_00_00_00 or $00_00_00_01.
I can do this with if-else, but when if-else tests false it wastes four clock cycles. I would like to know if there's a single direct operation that can perform this. Something like a shift left that preserves the LSB. I can't seem to find a solution.
Thanks for any suggestions - David
Post Edited (Drone) : 8/18/2009 11:34:58 AM GMT
I can do this with if-else, but when if-else tests false it wastes four clock cycles. I would like to know if there's a single direct operation that can perform this. Something like a shift left that preserves the LSB. I can't seem to find a solution.
Thanks for any suggestions - David
Post Edited (Drone) : 8/18/2009 11:34:58 AM GMT
Comments
using a table
with shifts, assuming result has the value already:
another could be, if the value is in memory, this could be the shortest I can think of...
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Visit some of my articles at Propeller Wiki:
MATH on the propeller propeller.wikispaces.com/MATH
pPropQL: propeller.wikispaces.com/pPropQL
pPropQL020: propeller.wikispaces.com/pPropQL020
OMU for the pPropQL/020 propeller.wikispaces.com/OMU
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Composite NTSC sprite driver: Forum
NTSC & PAL driver templates: ObEx Forum
OnePinTVText driver: ObEx Forum
MUXNZ value,#$FF
Jonathan
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lonesock
Piranha are people too.
Best Regards, David