diff options
Diffstat (limited to 'include/clang/AST/CharUnits.h')
-rw-r--r-- | include/clang/AST/CharUnits.h | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/include/clang/AST/CharUnits.h b/include/clang/AST/CharUnits.h index 09ff6828ef5c..72ca9f5cd67d 100644 --- a/include/clang/AST/CharUnits.h +++ b/include/clang/AST/CharUnits.h @@ -165,7 +165,7 @@ namespace clang { /// RoundUpToAlignment - Returns the next integer (mod 2**64) that is /// greater than or equal to this quantity and is a multiple of \p Align. /// Align must be non-zero. - CharUnits RoundUpToAlignment(const CharUnits &Align) { + CharUnits RoundUpToAlignment(const CharUnits &Align) const { return CharUnits(llvm::RoundUpToAlignment(Quantity, Align.Quantity)); } @@ -173,12 +173,7 @@ namespace clang { /// Given that this is a non-zero alignment value, what is the /// alignment at the given offset? CharUnits alignmentAtOffset(CharUnits offset) { - // alignment: 0010000 - // offset: 1011100 - // lowBits: 0001011 - // result: 0000100 - QuantityType lowBits = (Quantity-1) & (offset.Quantity-1); - return CharUnits((lowBits + 1) & ~lowBits); + return CharUnits(llvm::MinAlign(Quantity, offset.Quantity)); } |