This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
bsf on atom
- From: OndÅej BÃlka <neleai at seznam dot cz>
- To: libc-help at sourceware dot org
- Cc: liubov dot dmitrieva at gmail dot com
- Date: Thu, 30 Aug 2012 17:07:55 +0200
- Subject: 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.