sswap.c
Go to the documentation of this file.
00001 /* interchanges two vectors
00002    uses unrolled loops for increments equal to 1.
00003    Ver.1.0, May,26,1988.                         */
00004 
00005 #include "arith.h"
00006 
00007 sswap(n,sx,isx,jsx,incx,sy,isy,jsy,incy)
00008 int n,isx,jsx,incx,isy,jsy,incy;
00009 MATRIX sx,sy;
00010 {
00011     REAL stemp;
00012     int i,ix,iy,m;
00013 
00014     if(n <= 0)
00015         return;
00016 
00017     /* code for both increments equal to 1 */
00018 
00019     /* clean-up loop */
00020 
00021     m=n%3;
00022     if(m != 0){
00023         for(i=0; i<m; i++){
00024             stemp=sx[isx+i][jsx];
00025             sx[isx+i][jsx]=sy[isy+i][jsy];
00026             sy[isy+i][jsy]=stemp;
00027         }
00028         if(n < 3)
00029             return;
00030     }
00031 
00032     for(i=m; i<n; i += 3){
00033             stemp=sx[isx+i][jsx];
00034             sx[isx+i][jsx]=sy[isy+i][jsy];
00035             sy[isy+i][jsy]=stemp;
00036             stemp=sx[isx+i+1][jsx];
00037             sx[isx+i+1][jsx]=sy[isy+i+1][jsy];
00038             sy[isy+i+1][jsy]=stemp;
00039             stemp=sx[isx+i+2][jsx];
00040             sx[isx+i+2][jsx]=sy[isy+i+2][jsy];
00041             sy[isy+i+2][jsy]=stemp;
00042         }
00043 }


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 6 2019 18:05:53