fix warnign in release mode

This commit is contained in:
Eduardo Bart 2011-12-30 04:52:43 -02:00
parent 08fbedce38
commit f7dd35f0dd
1 changed files with 32 additions and 26 deletions

View File

@ -83,19 +83,18 @@ void Matrix<N,M,T>::setIdentity() {
template<int N, int M, typename T> template<int N, int M, typename T>
bool Matrix<N,M,T>::isIdentity() const { bool Matrix<N,M,T>::isIdentity() const {
for(int i=0;i<N;++i) { for(int i=0;i<N;++i)
for(int j=0;j<M;++j) { for(int j=0;j<M;++j)
if((i==j && m[i][j] != 1.0f) || (i!=j && m[i][j] != 0.0f)) if((i==j && m[i][j] != 1.0f) || (i!=j && m[i][j] != 0.0f))
return false; return false;
}
}
return true; return true;
} }
template<int N, int M, typename T> template<int N, int M, typename T>
void Matrix<N,M,T>::fill(T value) { void Matrix<N,M,T>::fill(T value) {
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
m[0][i] = value; for(int j=0;j<M;++j)
m[i][j] = value;
} }
template<int N, int M, typename T> template<int N, int M, typename T>
@ -111,8 +110,9 @@ template<int N, int M, typename T>
template<typename U> template<typename U>
Matrix<N,M,T>& Matrix<N,M,T>::operator=(const std::initializer_list<U>& values) { Matrix<N,M,T>& Matrix<N,M,T>::operator=(const std::initializer_list<U>& values) {
auto it = values.begin(); auto it = values.begin();
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
m[0][i] = *(it++); for(int j=0;j<M;++j)
m[i][j] = *(it++);
return *this; return *this;
} }
@ -127,37 +127,42 @@ Matrix<N,M,T>& Matrix<N,M,T>::operator=(const U *values) {
template<int N, int M, typename T> template<int N, int M, typename T>
Matrix<N,M,T>& Matrix<N,M,T>::operator+=(const Matrix<N,M,T>& other) { Matrix<N,M,T>& Matrix<N,M,T>::operator+=(const Matrix<N,M,T>& other) {
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
m[0][i] += other.m[0][i]; for(int j=0;j<M;++j)
m[i][j] += other.m[i][j];
return *this; return *this;
} }
template<int N, int M, typename T> template<int N, int M, typename T>
Matrix<N,M,T>& Matrix<N,M,T>::operator-=(const Matrix<N,M,T>& other) { Matrix<N,M,T>& Matrix<N,M,T>::operator-=(const Matrix<N,M,T>& other) {
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
m[0][i] -= other.m[0][i]; for(int j=0;j<M;++j)
m[i][j] -= other.m[i][j];
return *this; return *this;
} }
template<int N, int M, typename T> template<int N, int M, typename T>
Matrix<N,M,T>& Matrix<N,M,T>::operator*=(T factor) { Matrix<N,M,T>& Matrix<N,M,T>::operator*=(T factor) {
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
m[0][i] *= factor; for(int j=0;j<M;++j)
m[i][j] *= factor;
return *this; return *this;
} }
template<int N, int M, typename T> template<int N, int M, typename T>
Matrix<N,M,T>& Matrix<N,M,T>::operator/=(T divisor) { Matrix<N,M,T>& Matrix<N,M,T>::operator/=(T divisor) {
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
m[0][i] /= divisor; for(int j=0;j<M;++j)
m[i][j] /= divisor;
return *this; return *this;
} }
template<int N, int M, typename T> template<int N, int M, typename T>
bool Matrix<N,M,T>::operator==(const Matrix<N,M,T>& other) const bool Matrix<N,M,T>::operator==(const Matrix<N,M,T>& other) const
{ {
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
if(m[0][i] != other.m[0][i]) for(int j=0;j<M;++j)
if(m[i][j] != other.m[i][j])
return false; return false;
return true; return true;
} }
@ -165,8 +170,9 @@ bool Matrix<N,M,T>::operator==(const Matrix<N,M,T>& other) const
template<int N, int M, typename T> template<int N, int M, typename T>
bool Matrix<N,M,T>::operator!=(const Matrix<N,M,T>& other) const bool Matrix<N,M,T>::operator!=(const Matrix<N,M,T>& other) const
{ {
for(int i=0;i<N*M;++i) for(int i=0;i<N;++i)
if(m[0][i] != other.m[0][i]) for(int j=0;j<M;++j)
if(m[i][j] != other.m[i][j])
return true; return true;
return false; return false;
} }