Browse Source

Use a ternary in qr_solve.cpp

Scott Lahteine 9 years ago
parent
commit
54a39d8c1a
1 changed files with 2 additions and 8 deletions
  1. 2
    8
      Marlin/qr_solve.cpp

+ 2
- 8
Marlin/qr_solve.cpp View File

@@ -1488,16 +1488,10 @@ void dswap(int n, double x[], int incx, double y[], int incy)
1488 1488
       x[i + 2] = y[i + 2];
1489 1489
       y[i + 2] = temp;
1490 1490
     }
1491
-    if (0 <= incx)
1492
-      ix = 0;
1493
-    else
1494
-      ix = (- n + 1) * incx;
1495
-    if (0 <= incy)
1496
-      iy = 0;
1497
-    else
1498
-      iy = (- n + 1) * incy;
1499 1491
   }
1500 1492
   else {
1493
+    ix = (incx >= 0) ? 0 : (-n + 1) * incx;
1494
+    iy = (incy >= 0) ? 0 : (-n + 1) * incy;
1501 1495
     for (i = 0; i < n; i++) {
1502 1496
       temp = x[ix];
1503 1497
       x[ix] = y[iy];

Loading…
Cancel
Save