Roll over using addtition...
Kye
Posts: 2,200
Hello,
When adding to a number and causing it to go past( 2^31 - 1) (posx) is the number held as an unsigned number during the operation?
Basically I have this piece of code:
currentByte := ((currentByte + 32) & posx)
What it does is add 32 to a number and truncate any roll over that would occur.
Now I would just rather use:
currentByte += 32
So, how does spin handle this stuff? Does th number just become negative the next time you use it or does spin limit it at posx?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
When adding to a number and causing it to go past( 2^31 - 1) (posx) is the number held as an unsigned number during the operation?
Basically I have this piece of code:
currentByte := ((currentByte + 32) & posx)
What it does is add 32 to a number and truncate any roll over that would occur.
Now I would just rather use:
currentByte += 32
So, how does spin handle this stuff? Does th number just become negative the next time you use it or does spin limit it at posx?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Comments
-Phil
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,