Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L8KUa-0004yy-8l for qemu-devel@nongnu.org; Thu, 04 Dec 2008 15:08:08 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L8KUZ-0004yg-Ql for qemu-devel@nongnu.org; Thu, 04 Dec 2008 15:08:08 -0500 Received: from [199.232.76.173] (port=51342 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8KUZ-0004yQ-If for qemu-devel@nongnu.org; Thu, 04 Dec 2008 15:08:07 -0500 Received: from savannah.gnu.org ([199.232.41.3]:60892 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L8KUY-0003sr-Ul for qemu-devel@nongnu.org; Thu, 04 Dec 2008 15:08:07 -0500 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1L8KUY-00075C-KD for qemu-devel@nongnu.org; Thu, 04 Dec 2008 20:08:06 +0000 Received: from aliguori by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1L8KUY-000758-DN for qemu-devel@nongnu.org; Thu, 04 Dec 2008 20:08:06 +0000 MIME-Version: 1.0 Errors-To: aliguori Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Anthony Liguori Message-Id: Date: Thu, 04 Dec 2008 20:08:06 +0000 Subject: [Qemu-devel] [5872] Define fls() in terms of clz32(). Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 5872 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5872 Author: aliguori Date: 2008-12-04 20:08:06 +0000 (Thu, 04 Dec 2008) Log Message: ----------- Define fls() in terms of clz32(). As suggested by Laurent Desnogues. Signed-off-by: Anthony Liguori Modified Paths: -------------- trunk/cutils.c Modified: trunk/cutils.c =================================================================== --- trunk/cutils.c 2008-12-04 19:58:45 UTC (rev 5871) +++ trunk/cutils.c 2008-12-04 20:08:06 UTC (rev 5872) @@ -22,6 +22,7 @@ * THE SOFTWARE. */ #include "qemu-common.h" +#include "host-utils.h" void pstrcpy(char *buf, int buf_size, const char *str) { @@ -98,11 +99,5 @@ int fls(int i) { - int bit; - - for (bit=31; bit >= 0; bit--) - if (i & (1 << bit)) - return bit+1; - - return 0; + return 32 - clz32(i); }