lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Thu, 2 May 2013 09:58:02 +0900
From:	"민찬호" <chanho.min@....com>
To:	Geert Uytterhoeven <geert@...ux-m68k.org>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	이경식 <kyungsik.lee@....com>,
	Yann Collet <yann.collet.73@...il.com>,
	Bob Pearson <rpearson@...temfabricworks.com>,
	Richard Weinberger <richard@....at>,
	linux-kernel@...r.kernel.org,
	sparclinux <sparclinux@...r.kernel.org>,
	Linux/m68k <linux-m68k@...r.kernel.org>,
	Linux-Next <linux-next@...r.kernel.org>
Subject: Re: [PATCH] lib: add weak __clzsi2()/__clzdi2() functions


>No, the link errors are for __ctzdi2, not __clzdi2.
>__ctzdi2 can be implemented using __ffs().
>> How's about we stop using __builtin_ctz[ll]() altogether?  Use N-fls()?
>
>That was my first suggestion ;-)
>
Do we remove existing __builtin_ct[l]z?
Some architecture's __builtin_clz will be more optimized than N-fls
IMHO, This is not only about __builtin- but also supporting another
libgcc functions in kernel.
Some future user may need __clz[t]s[d]i2 symbol also.

>> btw, this:
>>
>> int __weak __clzsi2(int val)
>> {
>>        return BITS_PER_LONG - fls(val);
>> }
>>
>> looks wrong.  It will give a different result for 32- and 64-bit.
>
>Indeed. It should be hardcoded 32.
>
I will re-work this for 64-bit, and ctz also.

Thanks
Chanho Min

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists