[llvm-commits] [llvm] r65602 - /llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h
Bill Wendling
isanbard at gmail.com
Thu Feb 26 17:07:57 PST 2009
Author: void
Date: Thu Feb 26 19:07:56 2009
New Revision: 65602
URL: http://llvm.org/viewvc/llvm-project?rev=65602&view=rev
Log:
--- Merging (from foreign repository) r64691 into '.':
U include/llvm/Support/MathExtras.h
Add llvm::RoundUpToAlignment.
- No functionality change.
Modified:
llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h
Modified: llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h?rev=65602&r1=65601&r2=65602&view=diff
==============================================================================
--- llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h (original)
+++ llvm/branches/Apple/Dib/include/llvm/Support/MathExtras.h Thu Feb 26 19:07:56 2009
@@ -412,6 +412,18 @@
A |= (A >> 32);
return A + 1;
}
+
+/// RoundUpToAlignment - Returns the next integer (mod 2**64) that is
+/// greater than or equal to \arg Value and is a multiple of \arg
+/// Align. Align must be non-zero.
+///
+/// Examples:
+/// RoundUpToAlignment(5, 8) = 8
+/// RoundUpToAlignment(17, 8) = 24
+/// RoundUpToAlignment(~0LL, 8) = 0
+inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) {
+ return ((Value + Align - 1) / Align) * Align;
+}
} // End llvm namespace
More information about the llvm-commits
mailing list