[llvm] r264623 - Use 'alignTo' instead of re-inventing it. NFC

Douglas Katzman via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 12:23:23 PDT 2016


Author: dougk
Date: Mon Mar 28 14:23:23 2016
New Revision: 264623

URL: http://llvm.org/viewvc/llvm-project?rev=264623&view=rev
Log:
Use 'alignTo' instead of re-inventing it. NFC

Modified:
    llvm/trunk/include/llvm/Bitcode/BitstreamReader.h

Modified: llvm/trunk/include/llvm/Bitcode/BitstreamReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Bitcode/BitstreamReader.h?rev=264623&r1=264622&r2=264623&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Bitcode/BitstreamReader.h (original)
+++ llvm/trunk/include/llvm/Bitcode/BitstreamReader.h Mon Mar 28 14:23:23 2016
@@ -17,6 +17,7 @@
 
 #include "llvm/Bitcode/BitCodes.h"
 #include "llvm/Support/Endian.h"
+#include "llvm/Support/MathExtras.h"
 #include "llvm/Support/StreamingMemoryObject.h"
 #include <climits>
 #include <string>
@@ -366,8 +367,7 @@ public:
     assert(getCurrentByteNo() < Limit && "Move cursor before lowering limit");
 
     // Round to word boundary.
-    if (Limit & (sizeof(word_t) - 1))
-      Limit += sizeof(word_t) - Limit & (sizeof(word_t) - 1);
+    Limit = alignTo(Limit, sizeof(word_t));
 
     // Only change size if the new one is lower.
     if (!Size || Size > Limit)




More information about the llvm-commits mailing list