From: Keir Fraser Subject: Re: [PATCH] x86/hpet: simplify hpet_get_channel() Date: Fri, 23 Mar 2012 13:52:49 +0000 Message-ID: References: <4F6C6287020000780007A81A@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <4F6C6287020000780007A81A@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Gang Wei , xen-devel List-Id: xen-devel@lists.xenproject.org On 23/03/2012 10:46, "Jan Beulich" wrote: >> Why is the following for-loop changed into do-while? It looks like it just >> makes the code longer, especially as you replace a % operator with >> open-coded equivalent for no reason I can see. > > Simply because > > for ( i = next; i != next; ++i ) > > makes no sense. > > Removing the % is an efficiency thing - the resulting code is not only > faster, but also smaller (presumably because of the special register > limitations div has). Does that matter? It's the last thing done before going into deep sleep. I suppose I don't mind that much, the whole thing just seems to make the C code longer. -- Keir