sswap.c
Go to the documentation of this file.
1 /* interchanges two vectors
2  uses unrolled loops for increments equal to 1.
3  Ver.1.0, May,26,1988. */
4 
5 #include "arith.h"
6 
7 sswap(n,sx,isx,jsx,incx,sy,isy,jsy,incy)
8 int n,isx,jsx,incx,isy,jsy,incy;
9 MATRIX sx,sy;
10 {
11  REAL stemp;
12  int i,ix,iy,m;
13 
14  if(n <= 0)
15  return;
16 
17  /* code for both increments equal to 1 */
18 
19  /* clean-up loop */
20 
21  m=n%3;
22  if(m != 0){
23  for(i=0; i<m; i++){
24  stemp=sx[isx+i][jsx];
25  sx[isx+i][jsx]=sy[isy+i][jsy];
26  sy[isy+i][jsy]=stemp;
27  }
28  if(n < 3)
29  return;
30  }
31 
32  for(i=m; i<n; i += 3){
33  stemp=sx[isx+i][jsx];
34  sx[isx+i][jsx]=sy[isy+i][jsy];
35  sy[isy+i][jsy]=stemp;
36  stemp=sx[isx+i+1][jsx];
37  sx[isx+i+1][jsx]=sy[isy+i+1][jsy];
38  sy[isy+i+1][jsy]=stemp;
39  stemp=sx[isx+i+2][jsx];
40  sx[isx+i+2][jsx]=sy[isy+i+2][jsy];
41  sy[isy+i+2][jsy]=stemp;
42  }
43 }
arith.h
REAL
double REAL
Definition: arith.h:25
MATRIX
VECTOR MATRIX[MAX]
Definition: arith.h:27
ix
static int ix
Definition: printer.c:29
sswap
sswap(int n, MATRIX sx, int isx, int jsx, int incx, MATRIX sy, int isy, int jsy, int incy)
Definition: sswap.c:7
n
GLfloat n[6][3]
Definition: cube.c:15


euslisp
Author(s): Toshihiro Matsui
autogenerated on Thu Jun 15 2023 02:06:43