Faster comparisons

BlitzMax Forums/BlitzMax Programming/Faster comparisons

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Good idea about treating the variable as boolean, for tidyness sake, snarkbait.

I understand how processors work. On the 68000 series, however, operations such as branching based on conditions would use automatically set results produced from certain previous operations. You didn't have to explicitly compare two variables in order to set the condition flags, and the condition flags, once set, could be used in the decision of whether to branch - based on a given flag. So you could branch if zero, branch if nonzero, branch if greater than zero, etc... so it was faster to do that than to compare two variables.

I also don't think that anyone can ever claim that a certain piece of code is pointless to be optimized under all circumstances, because you have no idea how many times it is being called or how important it is in the overall picture. This is for a very very time-critical highly-used lots-of-processing routine so little bits of difference really do add up.

It's not so important that I'll lose sleep over it, especially as Blitz seems to not optimize it too well. I just wondered.