Work around GCC 4.0 build error:
authorJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 19 Nov 2010 05:36:51 +0000 (05:36 +0000)
committerJakob Stoklund Olesen <stoklund@2pi.dk>
Fri, 19 Nov 2010 05:36:51 +0000 (05:36 +0000)
llvm/include/llvm/ADT/IntervalMap.h:334: error: '((llvm::IntervalMapImpl::DesiredNodeBytes / static_cast<unsigned int>(((2 * sizeof (KeyT)) + sizeof (ValT)))) >? 3u)' is not a valid template argument for type 'unsigned int' because it is a non-constant expression

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@119790 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/ADT/IntervalMap.h

index f54a0abf6ce79c2c67f45d5fce3714c4d93f9dc0..8606a178b7b7ec90c6822cddac7da5c1ab7fcf50 100644 (file)
@@ -327,12 +327,15 @@ struct NodeSizer {
     DesiredLeafSize = DesiredNodeBytes /
       static_cast<unsigned>(2*sizeof(KeyT)+sizeof(ValT)),
     MinLeafSize = 3,
-    LeafSize = DesiredLeafSize > MinLeafSize ? DesiredLeafSize : MinLeafSize,
+    LeafSize = DesiredLeafSize > MinLeafSize ? DesiredLeafSize : MinLeafSize
+  };
+
+  typedef NodeBase<std::pair<KeyT, KeyT>, ValT, LeafSize> LeafBase;
 
+  enum {
     // Now that we have the leaf branching factor, compute the actual allocation
     // unit size by rounding up to a whole number of cache lines.
-    LeafBytes = sizeof(NodeBase<std::pair<KeyT, KeyT>, ValT, LeafSize>),
-    AllocBytes = (LeafBytes + CacheLineBytes-1) & ~(CacheLineBytes-1),
+    AllocBytes = (sizeof(LeafBase) + CacheLineBytes-1) & ~(CacheLineBytes-1),
 
     // Determine the branching factor for branch nodes.
     BranchSize = AllocBytes /