POV-Ray : Newsgroups : povray.off-topic : Unexpected : Re: Unexpected Server Time
28 Jul 2024 22:18:45 EDT (-0400)
  Re: Unexpected  
From: Orchid Win7 v1
Date: 19 Aug 2013 17:05:03
Message: <5212887f$1@news.povray.org>
On 19/08/2013 08:01 PM, Warp wrote:
> If we "disassemble" that back to C++, it's basically equivalent to:
>
> //-----------------------------------------
> int a(int input)
> {
>      return input == 0 ? 0 : -input;
> }
> //-----------------------------------------
>
> For some reason gcc produces a needless test against zero, but
> otherwise it's rather impressive that it got rid of the loop completely.

That *is* pretty impressive, actually... I wonder how on Earth it 
figures that out. I doubt anybody would have put a special case into the 
compiler just for this, so I wonder how it figures it out...


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.