lkml.org 
[lkml]   [2013]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] lib: add weak __clzsi2()/__clzdi2() functions
From
Date

>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



\
 
 \ /
  Last update: 2013-05-02 03:21    [W:0.060 / U:0.188 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site