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

Rafael EspĂ­ndola via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 17:02:21 PST 2016


Maybe just call RoundUpToAlignment directly everywhere?

Cheers,
Rafael


On 6 January 2016 at 18:34, Rui Ueyama via llvm-commits
<llvm-commits at lists.llvm.org> wrote:
> 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
>
>
> _______________________________________________
> 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