[PATCH] D16162: [Support] Rename RoundUpToAlignment -> align.

Xinliang David Li via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 13 20:32:42 PST 2016


lgtm.

On Wed, Jan 13, 2016 at 4:42 PM, Rui Ueyama <ruiu at google.com> wrote:
> ruiu updated this revision to Diff 44814.
> ruiu added a comment.
>
> - Renamed alignTo
>
>
> http://reviews.llvm.org/D16162
>
> Files:
>   include/llvm/Support/MathExtras.h
>
> Index: include/llvm/Support/MathExtras.h
> ===================================================================
> --- include/llvm/Support/MathExtras.h
> +++ include/llvm/Support/MathExtras.h
> @@ -606,22 +606,26 @@
>  ///
>  /// Examples:
>  /// \code
> -///   RoundUpToAlignment(5, 8) = 8
> -///   RoundUpToAlignment(17, 8) = 24
> -///   RoundUpToAlignment(~0LL, 8) = 0
> -///   RoundUpToAlignment(321, 255) = 510
> +///   alignTo(5, 8) = 8
> +///   alignTo(17, 8) = 24
> +///   alignTo(~0LL, 8) = 0
> +///   alignTo(321, 255) = 510
>  ///
> -///   RoundUpToAlignment(5, 8, 7) = 7
> -///   RoundUpToAlignment(17, 8, 1) = 17
> -///   RoundUpToAlignment(~0LL, 8, 3) = 3
> -///   RoundUpToAlignment(321, 255, 42) = 552
> +///   alignTo(5, 8, 7) = 7
> +///   alignTo(17, 8, 1) = 17
> +///   alignTo(~0LL, 8, 3) = 3
> +///   alignTo(321, 255, 42) = 552
>  /// \endcode
> -inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align,
> -                                   uint64_t Skew = 0) {
> +inline uint64_t alignTo(uint64_t Value, uint64_t Align, uint64_t Skew = 0) {
>    Skew %= Align;
>    return (Value + Align - 1 - Skew) / Align * Align + Skew;
>  }
>
> +inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align,
> +                                   uint64_t Skew = 0) {
> +  return alignTo(Value, Align, Skew);
> +}
> +
>  /// Returns the offset to the next integer (mod 2**64) that is greater than
>  /// or equal to \p Value and is a multiple of \p Align. \p Align must be
>  /// non-zero.
>
>


More information about the llvm-commits mailing list