[llvm-commits] CVS: llvm/lib/Support/FoldingSet.cpp

Jim Laskey jlaskey at apple.com
Thu Nov 2 06:21:43 PST 2006



Changes in directory llvm/lib/Support:

FoldingSet.cpp updated: 1.8 -> 1.9
---
Log message:

Allow FoldingSet clients to pump up the initial hash size.

---
Diffs of the changes:  (+4 -2)

 FoldingSet.cpp |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)


Index: llvm/lib/Support/FoldingSet.cpp
diff -u llvm/lib/Support/FoldingSet.cpp:1.8 llvm/lib/Support/FoldingSet.cpp:1.9
--- llvm/lib/Support/FoldingSet.cpp:1.8	Sun Oct 29 03:19:59 2006
+++ llvm/lib/Support/FoldingSet.cpp	Thu Nov  2 08:21:26 2006
@@ -151,8 +151,10 @@
 //===----------------------------------------------------------------------===//
 // FoldingSetImpl Implementation
 
-FoldingSetImpl::FoldingSetImpl() : NumNodes(0) {
-  NumBuckets = 64;
+FoldingSetImpl::FoldingSetImpl(unsigned Log2InitSize) : NumNodes(0) {
+  assert(5 < Log2InitSize && Log2InitSize < 32 &&
+         "Initial hash table size out of range");
+  NumBuckets = 1 << Log2InitSize;
   Buckets = new void*[NumBuckets];
   memset(Buckets, 0, NumBuckets*sizeof(void*));
 }






More information about the llvm-commits mailing list