improve strlen
- From: "Claudio Daffra" <spamtrap@xxxxxxxxxx>
- Date: Sun, 23 Oct 2005 23:10:40 +0000 (UTC)
hi all
i have read some manual pent opt;
i have tried write my pesonal routine faster than gcc compiler,
simply routine only
about strlen the result is the same time
my code and code is similar code found in paul hsieh page
i have tried read at the same time word and dword but result don't
chage
my routine work at the same time as strlen
any one know other solution (maybe mmx ist4uction) to improve the
algorithm)
regards
claudio
void RoutineC ( void )
{
char *source = "01234567890ABCDEF0123456789ABCDEF" \
"01234567890ABCDEF0123456789ABCDEF" \
"01234567890ABCDEF0123456789ABCDEF" \
"01234567890ABCDEF0123456789ABCDE\0" ; // 128 caratteri
unsigned int len = 0;
len = strlen ( &source[0] ) ;
}
void RoutineASM ( void )
{
char *source = "01234567890ABCDEF0123456789ABCDEF" \
"01234567890ABCDEF0123456789ABCDEF" \
"01234567890ABCDEF0123456789ABCDEF" \
"01234567890ABCDEF0123456789ABCDE\0" ; // 128 caratteri
unsigned int len = 0;
__asm__ ( " .p2align 4,,15\n\t"
" movl %%ebx ,%%edx\n\t"
"l1: movb (%%ebx) ,%%ah\n\t"
" incl %%ebx\n\t"
" test %%ah ,%%ah\n\t"
" jne l1\n\t"
" subl %%ebx,%%edx\n\t"
: "=b" (len)
: "d" (&source[0])
: "ebx", "edx"
) ;
len = len ;
}
.
- Follow-Ups:
- Re: improve strlen
- From: spamtrap
- Re: improve strlen
- Prev by Date: Self-modifying code on SMP operating systems
- Next by Date: Re: compiler generated output
- Previous by thread: Self-modifying code on SMP operating systems
- Next by thread: Re: improve strlen
- Index(es):