cowgol
cowgol copied to clipboard
small optimization: % poweroftwo -> & poweroftwo-1
Thanks --- that's definitely worth having. There are likely to be edge conditions regarding signed values, though. Could you make sure that there are tests for this case?
I think divrem tests already cover this:
print("four%two==zero"); if four%two==zero then yes(); else no(); end if;
Sorry, I got distracted by other things... also I didn't spot that this just concerns REMU, and not REMS.
Yes, all looks good. Merging.
Trying to do the same optimisation for signed values looks like it'll be nightmare. Getting the result sign right was bad enough just for the normal divmod calculation.