[OT] compiler optimisations

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 23 19:07:32 PDT 2015


On 4/23/2015 3:23 AM, Andrea Fontana wrote:
> I was wondering if compilers can optimize this:
>
> uint foo3(uint a)
> {
>    return a*!(a/5);
> }
>
> That actually gives the same results.

A fun article about these sorts of things:

http://www.davespace.co.uk/blog/20150131-branchless-sequences.html


More information about the Digitalmars-d mailing list