Browse Source

Removed redundant method findBucketToInsert()

tempestpy_adaptions
Matthias Volk 6 years ago
parent
commit
5d21109624
  1. 19
      src/storm/storage/BitVectorHashMap.cpp
  2. 13
      src/storm/storage/BitVectorHashMap.h

19
src/storm/storage/BitVectorHashMap.cpp

@ -102,7 +102,7 @@ namespace storm {
std::pair<ValueType, uint64_t> BitVectorHashMap<ValueType, Hash>::findOrAddAndGetBucket(storm::storage::BitVector const& key, ValueType const& value) {
checkIncreaseSize();
std::pair<bool, uint64_t> flagAndBucket = this->findBucketToInsert(key);
std::pair<bool, uint64_t> flagAndBucket = this->findBucket(key);
if (flagAndBucket.first) {
return std::make_pair(values[flagAndBucket.second], flagAndBucket.second);
} else {
@ -174,23 +174,6 @@ namespace storm {
return std::make_pair(false, bucket);
}
template<class ValueType, class Hash>
std::pair<bool, uint64_t> BitVectorHashMap<ValueType, Hash>::findBucketToInsert(storm::storage::BitVector const& key) {
uint64_t bucket = hasher(key) >> this->getCurrentShiftWidth();
while (isBucketOccupied(bucket)) {
if (buckets.matches(bucket * bucketSize, key)) {
return std::make_pair(true, bucket);
}
++bucket;
if (bucket == (1ull << currentSize)) {
bucket = 0;
}
}
return std::make_pair(false, bucket);
}
template<class ValueType, class Hash>
std::pair<storm::storage::BitVector, ValueType> BitVectorHashMap<ValueType, Hash>::getBucketAndValue(uint64_t bucket) const {
return std::make_pair(buckets.get(bucket * bucketSize, bucketSize), values[bucket]);

13
src/storm/storage/BitVectorHashMap.h

@ -170,19 +170,6 @@ namespace storm {
*/
std::pair<bool, uint64_t> findBucket(storm::storage::BitVector const& key) const;
/*!
* Searches for the bucket into which the given key can be inserted. If no empty bucket can be found, the
* size of the underlying data structure is increased.
*
* @param key The key to search for.
* @param increaseStorage A flag indicating whether the storage should be increased if no bucket can be found.
* @return A tuple whose first component indicates whether the key is already contained in the map, whose
* second component indicates in which bucket the key is supposed to be stored and whose third component is
* an error flag indicating that the bucket could not be found (e.g. due to the restriction that the storage
* must not be increased).
*/
std::pair<bool, uint64_t> findBucketToInsert(storm::storage::BitVector const& key);
/*!
* Inserts the given key-value pair without resizing the underlying storage. If that fails, this is
* indicated by the return value.

Loading…
Cancel
Save