Types and Matrix don't emit Wunused-value warnings from __builtin_expect

When using Types or Matrix with the nvcc compiler with Wunused-value
enabled you would get the following warning:
(__builtin_expect(!(rowIndex < (this,NUM_ROWS)), 0)) ?
__assert_rtn(__func__, "vtkm/Matrix.h", 86, "rowIndex < this->NUM_ROWS") :
((void)0);

This is solved by changing this->NUM_ROWS to just NUM_ROWS.
This commit is contained in:
Robert Maynard 2017-01-03 11:05:25 -05:00
parent 1052a71523
commit 270ece24b3
2 changed files with 8 additions and 8 deletions

@ -61,7 +61,7 @@ public:
const vtkm::Vec<ComponentType, NUM_COLUMNS> &
operator[](vtkm::IdComponent rowIndex) const {
VTKM_ASSERT(rowIndex >= 0);
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
VTKM_ASSERT(rowIndex < NUM_ROWS);
return this->Components[rowIndex];
}
@ -72,7 +72,7 @@ public:
vtkm::Vec<ComponentType, NUM_COLUMNS> &
operator[](vtkm::IdComponent rowIndex) {
VTKM_ASSERT(rowIndex >= 0);
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
VTKM_ASSERT(rowIndex < NUM_ROWS);
return this->Components[rowIndex];
}
@ -83,9 +83,9 @@ public:
const ComponentType &
operator()(vtkm::IdComponent rowIndex, vtkm::IdComponent colIndex) const {
VTKM_ASSERT(rowIndex >= 0);
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
VTKM_ASSERT(rowIndex < NUM_ROWS);
VTKM_ASSERT(colIndex >= 0);
VTKM_ASSERT(colIndex < this->NUM_COLUMNS);
VTKM_ASSERT(colIndex < NUM_COLUMNS);
return (*this)[rowIndex][colIndex];
}
@ -96,9 +96,9 @@ public:
ComponentType &
operator()(vtkm::IdComponent rowIndex, vtkm::IdComponent colIndex) {
VTKM_ASSERT(rowIndex >= 0);
VTKM_ASSERT(rowIndex < this->NUM_ROWS);
VTKM_ASSERT(rowIndex < NUM_ROWS);
VTKM_ASSERT(colIndex >= 0);
VTKM_ASSERT(colIndex < this->NUM_COLUMNS);
VTKM_ASSERT(colIndex < NUM_COLUMNS);
return (*this)[rowIndex][colIndex];
}

@ -689,14 +689,14 @@ public:
const ComponentType& operator[](vtkm::IdComponent idx) const
{
VTKM_ASSERT(idx >= 0);
VTKM_ASSERT(idx < this->NUM_COMPONENTS);
VTKM_ASSERT(idx < NUM_COMPONENTS);
return this->Components[idx];
}
VTKM_EXEC_CONT
ComponentType& operator[](vtkm::IdComponent idx)
{
VTKM_ASSERT(idx >= 0);
VTKM_ASSERT(idx < this->NUM_COMPONENTS);
VTKM_ASSERT(idx < NUM_COMPONENTS);
return this->Components[idx];
}