06-28-2003, 09:12 AM
To do a bullet proof flip-flop in QB where -1 is TRUE and 0 is FALSE (for convention, as -1 has all bits set)...
That way, if x%<>0 -> it will turn 0 (FALSE), and if x%=0 it will turn -1 (TRUE).
I know that any nonzero value is equal to an IF, but if you are gonna do bitwise operations later you'll have problems if that number isn't -1 (all bits set).
Code:
x% = NOT -ABS(SGN(x%))
That way, if x%<>0 -> it will turn 0 (FALSE), and if x%=0 it will turn -1 (TRUE).
I know that any nonzero value is equal to an IF, but if you are gonna do bitwise operations later you'll have problems if that number isn't -1 (all bits set).
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i