fast string copy
Col. G. L. Sicherman
colonel at gloria.UUCP
Thu Mar 28 10:43:11 AEST 1985
["In the service of Virman Vundabar we learn perfection!"]
> I think this is cute, how VAX/VMS beats Unix at its own game. The VMS C
> compiler generates code as good as or better than anything I have seen posted
> so far!
>
> char *s,*t;
> while (*s++ = *t++);
>
> generates (on a VAX 780):
>
> movb (r2)+,(r1)+
> beql sym.2
> sym.1:
> movb (r2)+,(r1)+
> bneq sym.1
> sym.2:
>
> This is as fast as you can get.
Careful! You can probably speed it up by unrolling the loop....
--
Col. G. L. Sicherman
...{rocksvax|decvax}!sunybcs!colonel
More information about the Comp.lang.c
mailing list