bsf on atom

Ondřej Bílka neleai@seznam.cz
Fri Aug 31 12:50:00 GMT 2012


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.



More information about the Libc-help mailing list