2 ms·
How would you rewrite it to "tighten it up"?
by rootlocus 11y ago
How would you rewrite it to "tighten it up"?
- mtdewcmu 11y agoI would make that series of if-statements more obviously deterministic, for starters. One way of accomplishing that would be a bunch of nested if-else blocks. However, that would be ugly. I'd prefer something like continue statements -- which would necessitate redesigning the loop to avoid bypassing the code at the bottom. Either way, the way this currently gives the appearance of being possibly nondeterministic makes me uncomfortable... and besides, executing those extra conditionals wastes CPU cycles.