mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-01 01:43:57 +00:00
Add MathExtras.h OffsetToAlignment, like RoundUpToAlignment but returns the
offset to the next aligned integer. llvm-svn: 80339
This commit is contained in:
parent
1b35869d3d
commit
300b88539d
@ -435,6 +435,13 @@ inline uint64_t RoundUpToAlignment(uint64_t Value, uint64_t Align) {
|
||||
return ((Value + Align - 1) / Align) * Align;
|
||||
}
|
||||
|
||||
/// OffsetToAlignment - Return the offset to 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.
|
||||
inline uint64_t OffsetToAlignment(uint64_t Value, uint64_t Align) {
|
||||
return RoundUpToAlignment(Value, Align) - Value;
|
||||
}
|
||||
|
||||
/// abs64 - absolute value of a 64-bit int. Not all environments support
|
||||
/// "abs" on whatever their name for the 64-bit int type is. The absolute
|
||||
/// value of the largest negative number is undefined, as with "abs".
|
||||
|
Loading…
x
Reference in New Issue
Block a user