[llvm-commits] [llvm] r66594 - /llvm/trunk/include/llvm/Support/Allocator.h

Mon P Wang wangmp at apple.com
Tue Mar 10 16:04:40 PDT 2009


Author: wangmp
Date: Tue Mar 10 18:04:40 2009
New Revision: 66594

URL: http://llvm.org/viewvc/llvm-project?rev=66594&view=rev
Log:
Fixed rounding up EltSize

Modified:
    llvm/trunk/include/llvm/Support/Allocator.h

Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=66594&r1=66593&r2=66594&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Tue Mar 10 18:04:40 2009
@@ -77,7 +77,7 @@
   template <typename T>
   T *Allocate(size_t Num, unsigned Alignment) {
     // Round EltSize up to the specified alignment.
-    unsigned EltSize = (sizeof(T)+Alignment-1)&~Alignment;
+    unsigned EltSize = (sizeof(T)+Alignment-1)&(-Alignment);
     return static_cast<T*>(Allocate(Num * EltSize, Alignment));
   }
 





More information about the llvm-commits mailing list