[gst-devel] [gst-cvs] gstreamer: micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers

Edward Hervey bilboed at gmail.com
Fri Dec 3 12:59:33 CET 2010


On Fri, 2010-12-03 at 11:47 +0000, Tim-Philipp Müller wrote:
> On Fri, 2010-12-03 at 03:04 -0800, Edward Hervey wrote:
> 
> > Module: gstreamer
> > Branch: master
> > Commit: 6aa8ca37eeb9debfa6919741a023250bf278248f
> > URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=6aa8ca37eeb9debfa6919741a023250bf278248f
> > 
> > Author: Edward Hervey <bilboed at bilboed.com>
> > Date:   Sat Apr 11 15:04:41 2009 +0200
> > 
> > micro-optim: if (x) is cheaper than if (x > 0) for unsigned integers
> 
> I really really dislike this change. Is it really worth it?

  I saw gcc asm where it was doing an expensive compare as opposed to a
fast != 0. So yes, needed. Worth it ? Well I did title it "micro-optim".

> 
> I think this compromises code readability too much.

  You mean if(x) is ... unreadable ? Isn't that C 101 ?

    Edward

> 
> Cheers
>  -Tim
> 
> 






More information about the gstreamer-devel mailing list