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

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 28 13:38:32 PDT 2016


Thanks!

> On 2016-Mar-28, at 12:23, Douglas Katzman via llvm-commits <llvm-commits at lists.llvm.org> wrote:
> 
> 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)
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list