This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bsf on atom


Hello, I now again have time to string functions. 

I consider using following replacement of bsf:

static char first_bit_short_ary[]=
{[0]=16,[1]=0,[2]=1,[4]=2,[8]=3,[16]=4,[32]=5,[64]=6,[128]=7,[256]=8,
[512]=9,[1024]=10,[2048]=11,[4096]=12,[8192]=13,[16384]=14,[32768]=15
};
inline int first_bit_short(int x){
  return first_bit_short_ary[x&(-x)];
}

in function prologue as it deals only 16 bit values. 
How fast is this on atom?
Cost is 11 cache lines which look acceptable to me.

-- 

Budget cuts forced us to sell all the power cords for the servers.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]