Browse Source

resolve bug (index out of bounds exception)

Former-commit-id: ffc7970e50
tempestpy_adaptions
ThomasH 9 years ago
parent
commit
904a7aecc0
  1. 4
      src/storage/gspn/Marking.cpp

4
src/storage/gspn/Marking.cpp

@ -20,7 +20,7 @@ namespace storm {
void Marking::setNumberOfTokensAt(uint_fast64_t place, uint_fast64_t numberOfTokens) { void Marking::setNumberOfTokensAt(uint_fast64_t place, uint_fast64_t numberOfTokens) {
//check range //check range
for (uint_fast64_t i = getNumberOfPlaces() * numberOfBits; i <(getNumberOfPlaces() * numberOfBits) + numberOfBits; ++i) {
for (uint_fast64_t i = place * numberOfBits; i <(place * numberOfBits) + numberOfBits; ++i) {
if (numberOfTokens % 2 == 0) { if (numberOfTokens % 2 == 0) {
marking.set(i, false); marking.set(i, false);
} else { } else {
@ -32,7 +32,7 @@ namespace storm {
uint_fast64_t Marking::getNumberOfTokensAt(uint_fast64_t place) { uint_fast64_t Marking::getNumberOfTokensAt(uint_fast64_t place) {
uint_fast64_t tokens = 0; uint_fast64_t tokens = 0;
for (uint_fast64_t i = getNumberOfPlaces() * numberOfBits, mult = 0; i <(getNumberOfPlaces() * numberOfBits) + numberOfBits; ++i, ++mult) {
for (uint_fast64_t i = place * numberOfBits, mult = 0; i < (place * numberOfBits) + numberOfBits; ++i, ++mult) {
if (marking.get(i)) { if (marking.get(i)) {
tokens += std::pow(2, mult); tokens += std::pow(2, mult);
} }

Loading…
Cancel
Save