quick question, probably of little importance...

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Wed Apr 26 23:17:40 UTC 2023


On 27/04/2023 11:07 AM, WhatMeWorry wrote:
> On Wednesday, 26 April 2023 at 23:02:07 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> Don't forget ``num % 2 == 0``.
>>
>> None should matter, pretty much all production compilers within the 
>> last 30 years should recognize all forms of this and do the right thing.
> 
> Thanks. Fastest reply ever! And I believe across the world?   I suppose 
> my examples required overhead of a function call. So maybe num % 2 == 0 
> is fastest?

Indeed, all the way from New Zealand.

I wouldn't bother timing this. A compiler will rewrite it and emit 
whatever instructions it thinks is best for a given cpu target that you 
select. This is one of those things that was solved 30 years ago :)


More information about the Digitalmars-d-learn mailing list