Message ID | 1441239463-18981-10-git-send-email-rth@twiddle.net |
---|---|
State | New |
Headers | show |
On 09/03/2015 02:17 AM, Richard Henderson wrote: > True, this is unused so far, but commented out is worse than > actually implemented properly. > > Signed-off-by: Richard Henderson <rth@twiddle.net> > --- > target-openrisc/int_helper.c | 23 ++++++++++++----------- > 1 file changed, 12 insertions(+), 11 deletions(-) > Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de>
diff --git a/target-openrisc/int_helper.c b/target-openrisc/int_helper.c index f75e1b3..6e12fab 100644 --- a/target-openrisc/int_helper.c +++ b/target-openrisc/int_helper.c @@ -25,19 +25,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); + } }
True, this is unused so far, but commented out is worse than actually implemented properly. Signed-off-by: Richard Henderson <rth@twiddle.net> --- target-openrisc/int_helper.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-)