Faster C

David Keppel pardo at june.cs.washington.edu
Sat Feb 6 12:26:13 AEST 1988


In article <473 at aati.UUCP> fish at aati.UUCP (William G. Fish) writes:
->I wish to make the following C code run as fast as possible under 4.1 BSD 
->on a VAX 11/750.  I've seen VAX instructions such as movc3 and cmpc3 make
->code run 10 to 50 times faster.  Are there any CISC instructions that can
->be used in this case?
->
->scan(in, out, c, C, S)
->    register short *in;
->    register float *out;
->    register c;
->    int C, S;
->{
->    register sample;
->    register s;
->
->    for (s = 0; s < S; s++, c += C)
->    {
->	out[s] = sample = in[c];	/* short to float conversion */

If you change the out[s] and in[c] to use a pointer that is incremented
each iteration, you may be able to save yourself an ashl each time.

	;-D on  (*gazing)  Pardo



More information about the Comp.lang.c mailing list