[lld] r256995 - Use RoundUpToAlignment instead of writing the expression to round up.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 6 15:34:13 PST 2016


Author: ruiu
Date: Wed Jan  6 17:34:12 2016
New Revision: 256995

URL: http://llvm.org/viewvc/llvm-project?rev=256995&view=rev
Log:
Use RoundUpToAlignment instead of writing the expression to round up.

The original code might be more readable than the new one if you
remember the expression. Otherwise the new one is probably better.

Modified:
    lld/trunk/ELF/OutputSections.h

Modified: lld/trunk/ELF/OutputSections.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.h?rev=256995&r1=256994&r2=256995&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.h (original)
+++ lld/trunk/ELF/OutputSections.h Wed Jan  6 17:34:12 2016
@@ -433,7 +433,7 @@ private:
 };
 
 inline uint64_t align(uint64_t Value, uint64_t Align) {
-  return (Value + Align - 1) & ~(Align - 1);
+  return llvm::RoundUpToAlignment(Value, Align);
 }
 
 // All output sections that are hadnled by the linker specially are




More information about the llvm-commits mailing list