Debian Codegraph @

debian/external_deps/fetk/punc/src/blas/sswap.c

raw
1 /* ./src_f77/sswap.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
8 /* Subroutine */ int sswap_(integer *n, real *sx, integer *incx, real *sy,
9 integer *incy)
10 {
11 /* System generated locals */
12 integer i__1;
13
14 /* Local variables */
15 static integer i__, m, ix, iy, mp1;
16 static real stemp;
17
18
19 /* interchanges two vectors. */
20 /* uses unrolled loops for increments equal to 1. */
21 /* jack dongarra, linpack, 3/11/78. */
22 /* modified 12/3/93, array(1) declarations changed to array(*) */
23
24
25 /* Parameter adjustments */
26 --sy;
27 --sx;
28
29 /* Function Body */
30 if (*n <= 0) {
31 return 0;
32 }
33 if (*incx == 1 && *incy == 1) {
34 goto L20;
35 }
36
37 /* code for unequal increments or equal increments not equal */
38 /* to 1 */
39
40 ix = 1;
41 iy = 1;
42 if (*incx < 0) {
43 ix = (-(*n) + 1) * *incx + 1;
44 }
45 if (*incy < 0) {
46 iy = (-(*n) + 1) * *incy + 1;
47 }
48 i__1 = *n;
49 for (i__ = 1; i__ <= i__1; ++i__) {
50 stemp = sx[ix];
51 sx[ix] = sy[iy];
52 sy[iy] = stemp;
53 ix += *incx;
54 iy += *incy;
55 /* L10: */
56 }
57 return 0;
58
59 /* code for both increments equal to 1 */
60
61
62 /* clean-up loop */
63
64 L20:
65 m = *n % 3;
66 if (m == 0) {
67 goto L40;
68 }
69 i__1 = m;
70 for (i__ = 1; i__ <= i__1; ++i__) {
71 stemp = sx[i__];
72 sx[i__] = sy[i__];
73 sy[i__] = stemp;
74 /* L30: */
75 }
76 if (*n < 3) {
77 return 0;
78 }
79 L40:
80 mp1 = m + 1;
81 i__1 = *n;
82 for (i__ = mp1; i__ <= i__1; i__ += 3) {
83 stemp = sx[i__];
84 sx[i__] = sy[i__];
85 sy[i__] = stemp;
86 stemp = sx[i__ + 1];
87 sx[i__ + 1] = sy[i__ + 1];
88 sy[i__ + 1] = stemp;
89 stemp = sx[i__ + 2];
90 sx[i__ + 2] = sy[i__ + 2];
91 sy[i__ + 2] = stemp;
92 /* L50: */
93 }
94 return 0;
95 } /* sswap_ */
96