All pastes #4844 Raw Edit

Anonymous

public cpp v1 · immutable
#4844 ·published 2005-01-27 15:54 UTC
rendered paste body
size_t scali_mmx_strlen(const char *zts) {    const char *start = zts;    unsigned int alignment = (unsigned int)zts & 7;    while(alignment--) if(!*zts++) return zts - 1 - start;    asm volatile("\		pxor %%mm0, %%mm0;\		pxor %%mm1, %%mm1;\		mmxloop:\		pcmpeqb (%0), %%mm0;\		pcmpeqb 8(%0), %%mm1;\		add $16, %0;\		por %%mm1, %%mm0;\		packsswb %%mm0, %%mm0;\		movd %%mm0, %0;\		pxor %%mm0, %%mm0;\		pxor %%mm1, %%mm1;\		test %0, %0;\		jz mmxloop;\		emms;\		sub $16, %0;\		"		: "=r"(zts)		: "r"(zts)	);    while (*zts++ != 0);    return zts - start - 1;}