diff --git a/src/NIF_IO.cpp b/src/NIF_IO.cpp index 91d24d38335f010c976ef5755edf95dfbb863016..c02e3961fab78d66c0922f696225c227c27bfbe5 100644 --- a/src/NIF_IO.cpp +++ b/src/NIF_IO.cpp @@ -839,16 +839,16 @@ ostream & operator<<( ostream & out, Char8String const & val ) { //InertiaMatrix void NifStream( InertiaMatrix & val, istream& in, const NifInfo & info ) { - for (int c = 0; c < 3; ++c) { - for (int r = 0; r < 4; ++r) { + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 4; ++c) { val[r][c] = ReadFloat( in ); } } } void NifStream( InertiaMatrix const & val, ostream& out, const NifInfo & info ) { - for (int c = 0; c < 3; ++c) { - for (int r = 0; r < 4; ++r) { + for (int r = 0; r < 3; ++r) { + for (int c = 0; c < 4; ++c) { WriteFloat( val[r][c], out ); } } diff --git a/src/nif_math.cpp b/src/nif_math.cpp index 48f317b70effe247ec9d830acf80330422093f50..b83a5574ad166cea16f9b87283d4c6c5a878bcc9 100644 --- a/src/nif_math.cpp +++ b/src/nif_math.cpp @@ -687,7 +687,7 @@ InertiaMatrix & InertiaMatrix::operator*=( const InertiaMatrix & rh ) { for (int i = 0; i < _countof(rows); i++) { for (int j = 0; j < 4; j++) { t = 0.0f; - for (int k = 0; k < 4; k++) { + for (int k = 0; k < _countof(rows); k++) { t += lh[i][k] * rh[k][j]; } r[i][j] = t;