Received: from eggs.gnu.org ([2001:4830:134:3::10]:38726) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCbl7-0002HN-Mt for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCbl2-0004SA-Nb for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:08 -0400 Received: from mail-qt0-x244.google.com ([2607:f8b0:400d:c0d::244]:34086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCbl2-0004S2-KF for qemu-devel@nongnu.org; Mon, 13 Jun 2016 19:59:04 -0400 Received: by mail-qt0-x244.google.com with SMTP id 9so5840932qtg.1 for ; Mon, 13 Jun 2016 16:59:04 -0700 (PDT) Received: from bigtime.com (71-37-54-227.tukw.qwest.net. [71.37.54.227]) by smtp.gmail.com with ESMTPSA id q200sm7547234qke.31.2016.06.13.16.59.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Jun 2016 16:59:03 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Mon, 13 Jun 2016 16:58:09 -0700 Message-Id: <1465862305-14090-10-git-send-email-rth@twiddle.net> In-Reply-To: <1465862305-14090-1-git-send-email-rth@twiddle.net> References: <1465862305-14090-1-git-send-email-rth@twiddle.net> Subject: [Qemu-devel] [PATCH 09/25] target-openrisc: Implement ff1 and fl1 for 64-bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org True, this is unused so far, but commented out is worse than actually implemented properly. Reviewed-by: Bastian Koppelmann Signed-off-by: Richard Henderson --- target-openrisc/int_helper.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/target-openrisc/int_helper.c b/target-openrisc/int_helper.c index 6482f8c..64f837c 100644 --- a/target-openrisc/int_helper.c +++ b/target-openrisc/int_helper.c @@ -26,19 +26,20 @@ target_ulong HELPER(ff1)(target_ulong x) { -/*#ifdef TARGET_OPENRISC64 - return x ? ctz64(x) + 1 : 0; -#else*/ - return x ? ctz32(x) + 1 : 0; -/*#endif*/ + if (x == 0) { + return 0; + } else if (TARGET_LONG_BITS == 64) { + return ctz64(x) + 1; + } else { + return ctz32(x) + 1; + } } target_ulong HELPER(fl1)(target_ulong x) { -/* not used yet, open it when we need or64. */ -/*#ifdef TARGET_OPENRISC64 - return 64 - clz64(x); -#else*/ - return 32 - clz32(x); -/*#endif*/ + if (TARGET_LONG_BITS == 64) { + return 64 - clz64(x); + } else { + return 32 - clz32(x); + } } -- 2.5.5