Mercurial > hg > octave-nkf
changeset 17663:7975d75f933c
Use std::swap in liboctave instead of temporary variable.
* liboctave/array/CColVector.cc, liboctave/array/CDiagMatrix.cc,
liboctave/array/CMatrix.cc, liboctave/array/CRowVector.cc,
liboctave/array/chMatrix.cc, liboctave/array/dColVector.cc,
liboctave/array/dDiagMatrix.cc, liboctave/array/dMatrix.cc,
liboctave/array/dRowVector.cc, liboctave/array/fCColVector.cc,
liboctave/array/fCDiagMatrix.cc, liboctave/array/fCMatrix.cc,
liboctave/array/fCRowVector.cc, liboctave/array/fColVector.cc,
liboctave/array/fDiagMatrix.cc, liboctave/array/fMatrix.cc,
liboctave/array/fRowVector.cc, liboctave/numeric/sparse-dmsolve.cc:
Use std::swap in liboctave instead of temporary variable.
author | Rik <rik@octave.org> |
---|---|
date | Tue, 15 Oct 2013 14:59:09 -0700 |
parents | 0b7f5c56f853 |
children | f4b0430fa5fd |
files | liboctave/array/CColVector.cc liboctave/array/CDiagMatrix.cc liboctave/array/CMatrix.cc liboctave/array/CRowVector.cc liboctave/array/chMatrix.cc liboctave/array/dColVector.cc liboctave/array/dDiagMatrix.cc liboctave/array/dMatrix.cc liboctave/array/dRowVector.cc liboctave/array/fCColVector.cc liboctave/array/fCDiagMatrix.cc liboctave/array/fCMatrix.cc liboctave/array/fCRowVector.cc liboctave/array/fColVector.cc liboctave/array/fDiagMatrix.cc liboctave/array/fMatrix.cc liboctave/array/fRowVector.cc liboctave/numeric/sparse-dmsolve.cc |
diffstat | 18 files changed, 52 insertions(+), 52 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/array/CColVector.cc +++ b/liboctave/array/CColVector.cc @@ -162,7 +162,7 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } if (r2 >= r1) { @@ -186,7 +186,7 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } if (r2 >= r1) { @@ -250,7 +250,7 @@ ComplexColumnVector ComplexColumnVector::extract (octave_idx_type r1, octave_idx_type r2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } octave_idx_type new_r = r2 - r1 + 1;
--- a/liboctave/array/CDiagMatrix.cc +++ b/liboctave/array/CDiagMatrix.cc @@ -250,8 +250,8 @@ ComplexMatrix ComplexDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_r = r2 - r1 + 1; octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/CMatrix.cc +++ b/liboctave/array/CMatrix.cc @@ -579,8 +579,8 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } if (r2 >= r1 && c2 >= c1) { @@ -607,8 +607,8 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } if (r2 >= r1 && c2 >=c1) { @@ -929,8 +929,8 @@ ComplexMatrix ComplexMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } return index (idx_vector (r1, r2+1), idx_vector (c1, c2+1)); }
--- a/liboctave/array/CRowVector.cc +++ b/liboctave/array/CRowVector.cc @@ -160,7 +160,7 @@ return *this; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } if (c2 >= c1) { @@ -184,7 +184,7 @@ return *this; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } if (c2 >= c1) { @@ -242,7 +242,7 @@ ComplexRowVector ComplexRowVector::extract (octave_idx_type c1, octave_idx_type c2) const { - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/chMatrix.cc +++ b/liboctave/array/chMatrix.cc @@ -169,8 +169,8 @@ charMatrix charMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_r = r2 - r1 + 1; octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/dColVector.cc +++ b/liboctave/array/dColVector.cc @@ -116,7 +116,7 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } if (r2 >= r1) { @@ -169,7 +169,7 @@ ColumnVector ColumnVector::extract (octave_idx_type r1, octave_idx_type r2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } octave_idx_type new_r = r2 - r1 + 1;
--- a/liboctave/array/dDiagMatrix.cc +++ b/liboctave/array/dDiagMatrix.cc @@ -159,8 +159,8 @@ Matrix DiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_r = r2 - r1 + 1; octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/dMatrix.cc +++ b/liboctave/array/dMatrix.cc @@ -425,8 +425,8 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } if (r2 >= r1 && c2 >= c1) { @@ -603,8 +603,8 @@ Matrix Matrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } return index (idx_vector (r1, r2+1), idx_vector (c1, c2+1)); }
--- a/liboctave/array/dRowVector.cc +++ b/liboctave/array/dRowVector.cc @@ -119,7 +119,7 @@ return *this; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } if (c2 >= c1) { @@ -164,7 +164,7 @@ RowVector RowVector::extract (octave_idx_type c1, octave_idx_type c2) const { - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/fCColVector.cc +++ b/liboctave/array/fCColVector.cc @@ -162,7 +162,7 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } if (r2 >= r1) { @@ -186,7 +186,7 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } if (r2 >= r1) { @@ -250,7 +250,7 @@ FloatComplexColumnVector FloatComplexColumnVector::extract (octave_idx_type r1, octave_idx_type r2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } octave_idx_type new_r = r2 - r1 + 1;
--- a/liboctave/array/fCDiagMatrix.cc +++ b/liboctave/array/fCDiagMatrix.cc @@ -250,8 +250,8 @@ FloatComplexMatrix FloatComplexDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_r = r2 - r1 + 1; octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/fCMatrix.cc +++ b/liboctave/array/fCMatrix.cc @@ -581,8 +581,8 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } if (r2 >= r1 && c2 >= c1) { @@ -609,8 +609,8 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } if (r2 >= r1 && c2 >=c1) { @@ -931,8 +931,8 @@ FloatComplexMatrix FloatComplexMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } return index (idx_vector (r1, r2+1), idx_vector (c1, c2+1)); }
--- a/liboctave/array/fCRowVector.cc +++ b/liboctave/array/fCRowVector.cc @@ -160,7 +160,7 @@ return *this; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } if (c2 >= c1) { @@ -184,7 +184,7 @@ return *this; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } if (c2 >= c1) { @@ -242,7 +242,7 @@ FloatComplexRowVector FloatComplexRowVector::extract (octave_idx_type c1, octave_idx_type c2) const { - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/fColVector.cc +++ b/liboctave/array/fColVector.cc @@ -115,7 +115,7 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } if (r2 >= r1) { @@ -168,7 +168,7 @@ FloatColumnVector FloatColumnVector::extract (octave_idx_type r1, octave_idx_type r2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } octave_idx_type new_r = r2 - r1 + 1;
--- a/liboctave/array/fDiagMatrix.cc +++ b/liboctave/array/fDiagMatrix.cc @@ -159,8 +159,8 @@ FloatMatrix FloatDiagMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_r = r2 - r1 + 1; octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/array/fMatrix.cc +++ b/liboctave/array/fMatrix.cc @@ -425,8 +425,8 @@ return *this; } - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } if (r2 >= r1 && c2 >= c1) { @@ -603,8 +603,8 @@ FloatMatrix FloatMatrix::extract (octave_idx_type r1, octave_idx_type c1, octave_idx_type r2, octave_idx_type c2) const { - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } return index (idx_vector (r1, r2+1), idx_vector (c1, c2+1)); }
--- a/liboctave/array/fRowVector.cc +++ b/liboctave/array/fRowVector.cc @@ -119,7 +119,7 @@ return *this; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } if (c2 >= c1) { @@ -164,7 +164,7 @@ FloatRowVector FloatRowVector::extract (octave_idx_type c1, octave_idx_type c2) const { - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_c = c2 - c1 + 1;
--- a/liboctave/numeric/sparse-dmsolve.cc +++ b/liboctave/numeric/sparse-dmsolve.cc @@ -133,8 +133,8 @@ { r2 -= 1; c2 -= 1; - if (r1 > r2) { octave_idx_type tmp = r1; r1 = r2; r2 = tmp; } - if (c1 > c2) { octave_idx_type tmp = c1; c1 = c2; c2 = tmp; } + if (r1 > r2) { std::swap (r1, r2); } + if (c1 > c2) { std::swap (c1, c2); } octave_idx_type new_r = r2 - r1 + 1; octave_idx_type new_c = c2 - c1 + 1;