• dukk@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    1 year ago

    That’s what I was thinking too… Although, I wouldn’t be surprised if most languages convert modulo 2 to this automatically.

      • dukk@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        1 year ago

        That’s the main issue with premature optimization: do it the “optimized” way and it may still be inefficient, or do it the obvious way and let the compiler turn it into its most optimized form. (Of course, not the case with all languages, but most mainstream compilers optimize the code to a decent extent.)