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 :)
  • quick question, ... WhatMeWorry via Digitalmars-d-learn
    • Re: quick q... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
      • Re: qui... WhatMeWorry via Digitalmars-d-learn
        • Re:... H. S. Teoh via Digitalmars-d-learn
        • Re:... Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
        • Re:... Cecil Ward via Digitalmars-d-learn
          • ... Cecil Ward via Digitalmars-d-learn

Reply via email to