nanogui: [patch] fix for zero width/height rectangles


Previous by date: 16 Jul 2005 08:53:55 +0100 Re: [patch] fix for zero width/height rectangles, Sun Yingfeng
Next by date: 16 Jul 2005 08:53:55 +0100 how is the baseline value defined?, Alexander Stohr
Previous in thread: 16 Jul 2005 08:53:55 +0100 Re: [patch] fix for zero width/height rectangles, Sun Yingfeng
Next in thread:

Subject: Re: [nanogui] Re: [patch] fix for zero width/height rectangles
From: Alex Holden ####@####.####
Date: 16 Jul 2005 08:53:55 +0100
Message-Id: <ABA4FBF6-8E34-4D7A-B0BA-A03FAF50887C@linuxhacker.org>

On 16 Jul 2005, at 02:39, Sun Yingfeng wrote:
> I think the first case:
>     if (!w || !h)
>         return;
> case reduce execution time than:
>     if ((w == 0) || (h == 0))
>         return;
> Because judge "not equal" is need less time than judge "equal" in  
> most CPU.

That's not right; the two are functionally identical and pretty much  
any modern compiler should generate the same machine code in both cases.

Having said that, I personally would use the former as a matter of  
style. '!variable' is such a common idiom in C that the meaning is  
instantly obvious, and it's quicker to type/read.

-- 
------------ Alex Holden - http://www.alexholden.net/ ------------
If it doesn't work, you're not hitting it with a big enough hammer


Previous by date: 16 Jul 2005 08:53:55 +0100 Re: [patch] fix for zero width/height rectangles, Sun Yingfeng
Next by date: 16 Jul 2005 08:53:55 +0100 how is the baseline value defined?, Alexander Stohr
Previous in thread: 16 Jul 2005 08:53:55 +0100 Re: [patch] fix for zero width/height rectangles, Sun Yingfeng
Next in thread:


Powered by ezmlm-browse 0.20.