Browse Source

Fix bitshift overflow

The simple 1 is a 32bit integer literal on most machines leading to an
overflow: 1<<32 == 0. Even on 64 bit machines.
tempestpy_adaptions
Daniel Basgöze 5 years ago
parent
commit
d62af9332b
  1. 4
      src/storm-dft/modelchecker/dft/DFTASFChecker.cpp

4
src/storm-dft/modelchecker/dft/DFTASFChecker.cpp

@ -255,7 +255,7 @@ namespace storm {
// Construct selected children from combination // Construct selected children from combination
std::vector<uint64_t> combinationChildren; std::vector<uint64_t> combinationChildren;
for (size_t j = 0; j < vot->nrChildren(); ++j) { for (size_t j = 0; j < vot->nrChildren(); ++j) {
if (combination & (1 << j)) {
if (combination & (1ul << j)) {
combinationChildren.push_back(childVarIndices.at(j)); combinationChildren.push_back(childVarIndices.at(j));
} }
} }
@ -270,7 +270,7 @@ namespace storm {
// Generate next permutation // Generate next permutation
combination = nextBitPermutation(combination); combination = nextBitPermutation(combination);
++k; ++k;
} while (combination < (1 << vot->nrChildren()) && combination != 0);
} while (combination < (1ul << vot->nrChildren()) && combination != 0);
// Constraint is OR over all possible combinations // Constraint is OR over all possible combinations
constraints.push_back(std::make_shared<IsMinimum>(timePointVariables.at(i), tmpVars)); constraints.push_back(std::make_shared<IsMinimum>(timePointVariables.at(i), tmpVars));

Loading…
Cancel
Save