diff --git a/src/parser/DeterministicSparseTransitionParser.cpp b/src/parser/DeterministicSparseTransitionParser.cpp index 60957a17a..cea04c4d7 100644 --- a/src/parser/DeterministicSparseTransitionParser.cpp +++ b/src/parser/DeterministicSparseTransitionParser.cpp @@ -44,7 +44,7 @@ namespace parser { * @param buf Data to scan. Is expected to be some char array. * @param maxnode Is set to highest id of all nodes. */ -uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, int_fast64_t& maxnode, RewardMatrixInformationStruct* rewardMatrixInformation) { +uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, uint_fast64_t& maxnode, RewardMatrixInformationStruct* rewardMatrixInformation) { bool isRewardMatrix = rewardMatrixInformation != nullptr; uint_fast64_t nonZeroEntryCount = 0; @@ -58,7 +58,8 @@ uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, int_fast /* * Check all transitions for non-zero diagonal entries and deadlock states. */ - int_fast64_t row, lastRow = -1, col; + int_fast64_t lastRow = -1; + uint_fast64_t row, col; uint_fast64_t readTransitionCount = 0; bool rowHadDiagonalEntry = false; double val; @@ -71,12 +72,12 @@ uint_fast64_t DeterministicSparseTransitionParser::firstPass(char* buf, int_fast col = checked_strtol(buf, &buf); if (!isRewardMatrix) { - if (lastRow != row) { + if (lastRow != (int_fast64_t)row) { if ((lastRow != -1) && (!rowHadDiagonalEntry)) { ++nonZeroEntryCount; rowHadDiagonalEntry = true; } - for (int_fast64_t skippedRow = lastRow + 1; skippedRow < row; ++skippedRow) { + for (uint_fast64_t skippedRow = (uint_fast64_t)(lastRow + 1); skippedRow < row; ++skippedRow) { ++nonZeroEntryCount; } lastRow = row; @@ -146,7 +147,7 @@ DeterministicSparseTransitionParser::DeterministicSparseTransitionParser(std::st /* * Perform first pass, i.e. count entries that are not zero. */ - int_fast64_t maxStateId; + uint_fast64_t maxStateId; uint_fast64_t nonZeroEntryCount = this->firstPass(file.data, maxStateId, rewardMatrixInformation); LOG4CPLUS_INFO(logger, "First pass on " << filename << " shows " << nonZeroEntryCount << " NonZeros."); diff --git a/src/parser/DeterministicSparseTransitionParser.h b/src/parser/DeterministicSparseTransitionParser.h index cb91901f8..870b1415e 100644 --- a/src/parser/DeterministicSparseTransitionParser.h +++ b/src/parser/DeterministicSparseTransitionParser.h @@ -26,7 +26,7 @@ class DeterministicSparseTransitionParser : public Parser { private: std::shared_ptr> matrix; - uint_fast64_t firstPass(char* buf, int_fast64_t &maxnode, RewardMatrixInformationStruct* rewardMatrixInformation); + uint_fast64_t firstPass(char* buf, uint_fast64_t &maxnode, RewardMatrixInformationStruct* rewardMatrixInformation); }; diff --git a/src/parser/NondeterministicSparseTransitionParser.cpp b/src/parser/NondeterministicSparseTransitionParser.cpp index 79bb9f3f5..4d9491ce1 100644 --- a/src/parser/NondeterministicSparseTransitionParser.cpp +++ b/src/parser/NondeterministicSparseTransitionParser.cpp @@ -91,7 +91,7 @@ uint_fast64_t NondeterministicSparseTransitionParser::firstPass(char* buf, uint_ // If we skipped some states, we need to reserve empty rows for all their nondeterministic // choices. - for (uint_fast64_t i = lastsource + 1; i < source; ++i) { + for (int_fast64_t i = lastsource + 1; i < source; ++i) { choices += ((*rewardMatrixInformation->nondeterministicChoiceIndices)[i + 1] - (*rewardMatrixInformation->nondeterministicChoiceIndices)[i]); } @@ -221,7 +221,7 @@ NondeterministicSparseTransitionParser::NondeterministicSparseTransitionParser(s } if (isRewardFile) { - if (choices > rewardMatrixInformation->rowCount || maxnode + 1 > rewardMatrixInformation->columnCount) { + if (choices > rewardMatrixInformation->rowCount || (uint_fast64_t)(maxnode + 1) > rewardMatrixInformation->columnCount) { LOG4CPLUS_ERROR(logger, "Reward matrix size exceeds transition matrix size."); throw storm::exceptions::WrongFileFormatException() << "Reward matrix size exceeds transition matrix size."; } else if (choices != rewardMatrixInformation->rowCount) { @@ -278,7 +278,7 @@ NondeterministicSparseTransitionParser::NondeterministicSparseTransitionParser(s // If we skipped some states, we need to reserve empty rows for all their nondeterministic // choices. - for (uint_fast64_t i = lastsource + 1; i < source; ++i) { + for (int_fast64_t i = lastsource + 1; i < source; ++i) { curRow += ((*rewardMatrixInformation->nondeterministicChoiceIndices)[i + 1] - (*rewardMatrixInformation->nondeterministicChoiceIndices)[i]); } diff --git a/src/storage/SparseMatrix.h b/src/storage/SparseMatrix.h index a96c21923..5cab2deb3 100644 --- a/src/storage/SparseMatrix.h +++ b/src/storage/SparseMatrix.h @@ -770,7 +770,7 @@ public: T constOne = storm::utility::constGetOne(); // copy diagonal entries to other matrix - for (int i = 0; i < rowCount; ++i) { + for (unsigned int i = 0; i < rowCount; ++i) { resultDinv->addNextValue(i, i, constOne / resultLU->getValue(i, i)); resultLU->getValue(i, i) = storm::utility::constGetZero(); }