[GIT] ppl/ppl(master): Code duplication and useless bitwise manipulation avoided.

Module: ppl/ppl Branch: master Commit: 3c7a8ef09f6d4cd46b25a40b1566535b1c7358ca URL: http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=3c7a8ef09f6d4...
Author: Roberto Bagnara bagnara@cs.unipr.it Date: Wed Apr 1 22:32:00 2009 +0200
Code duplication and useless bitwise manipulation avoided.
---
src/OR_Matrix.inlines.hh | 13 ++++++------- 1 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/OR_Matrix.inlines.hh b/src/OR_Matrix.inlines.hh index 4315e56..9124dd1 100644 --- a/src/OR_Matrix.inlines.hh +++ b/src/OR_Matrix.inlines.hh @@ -43,7 +43,7 @@ OR_Matrix<T>::row_first_element_index(const dimension_type k) { template <typename T> inline dimension_type OR_Matrix<T>::row_size(const dimension_type k) { - return (k+2) & ~dimension_type(1); + return k + 2 - k%2; }
#if PPL_OR_MATRIX_EXTRA_DEBUG @@ -250,7 +250,7 @@ OR_Matrix<T>::any_row_iterator<U>::operator+=(const difference_type m) { i += increment; value.first += increment; #if PPL_OR_MATRIX_EXTRA_DEBUG - value.size_ += (m - m % 2); + value.size_ += (m - m%2); #endif return *this; } @@ -337,7 +337,7 @@ template <typename T> template <typename U> inline dimension_type OR_Matrix<T>::any_row_iterator<U>::row_size() const { - return (e+2) & ~dimension_type(1); + return OR_Matrix::row_size(e); }
template <typename T> @@ -421,11 +421,10 @@ isqrt(unsigned long x) { template <typename T> inline dimension_type OR_Matrix<T>::max_num_rows() { - // Compute the maximum number of rows that - // are contained in a DB_Row that allocates - // a pseudo-triangular matrix. + // Compute the maximum number of rows that are contained in a DB_Row + // that allocates a pseudo-triangular matrix. dimension_type k = isqrt(2*DB_Row<T>::max_size() + 1); - return (k-1) & ~dimension_type(1); + return (k - 1) - (k - 1)%2; }
template <typename T>
participants (1)
-
Roberto Bagnara