llvm.org GIT mirror llvm / 00fa65b
Fix typeo. grow() cannot shrink storage. clear() should really nuke storage git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11865 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 16 years ago
3 changed file(s) with 15 addition(s) and 9 deletion(s). Raw diff Collapse all Expand all
88 //
99 // This file implements a dense map. A dense map template takes two
1010 // types. The first is the mapped type and the second is a functor
11 // that maps its argument to a size_t. On instanciation a "null" value
11 // that maps its argument to a size_t. On instantiation a "null" value
1212 // can be provided to be used as a "does not exist" indicator in the
1313 // map. A member function grow() is provided that given the value of
1414 // the maximally indexed key (the argument of the functor) makes sure
4747 }
4848
4949 void clear() {
50 storage_.assign(storage_.size(), nullVal_);
50 storage_.clear();
5151 }
5252
5353 void grow(IndexT n) {
54 storage_.resize(toIndex_(n) + 1, nullVal_);
54 unsigned NewSize = toIndex_(n) + 1;
55 if (NewSize > storage_.size())
56 storage_.resize(NewSize, nullVal_);
5557 }
5658 };
5759
88 //
99 // This file implements a dense map. A dense map template takes two
1010 // types. The first is the mapped type and the second is a functor
11 // that maps its argument to a size_t. On instanciation a "null" value
11 // that maps its argument to a size_t. On instantiation a "null" value
1212 // can be provided to be used as a "does not exist" indicator in the
1313 // map. A member function grow() is provided that given the value of
1414 // the maximally indexed key (the argument of the functor) makes sure
4747 }
4848
4949 void clear() {
50 storage_.assign(storage_.size(), nullVal_);
50 storage_.clear();
5151 }
5252
5353 void grow(IndexT n) {
54 storage_.resize(toIndex_(n) + 1, nullVal_);
54 unsigned NewSize = toIndex_(n) + 1;
55 if (NewSize > storage_.size())
56 storage_.resize(NewSize, nullVal_);
5557 }
5658 };
5759
88 //
99 // This file implements a dense map. A dense map template takes two
1010 // types. The first is the mapped type and the second is a functor
11 // that maps its argument to a size_t. On instanciation a "null" value
11 // that maps its argument to a size_t. On instantiation a "null" value
1212 // can be provided to be used as a "does not exist" indicator in the
1313 // map. A member function grow() is provided that given the value of
1414 // the maximally indexed key (the argument of the functor) makes sure
4747 }
4848
4949 void clear() {
50 storage_.assign(storage_.size(), nullVal_);
50 storage_.clear();
5151 }
5252
5353 void grow(IndexT n) {
54 storage_.resize(toIndex_(n) + 1, nullVal_);
54 unsigned NewSize = toIndex_(n) + 1;
55 if (NewSize > storage_.size())
56 storage_.resize(NewSize, nullVal_);
5557 }
5658 };
5759