AST: Simplify CharUnits::alignmentAtOffset

CharUnits::alignmentAtOffset is equivalent to llvm::MinAlign but
slightly less efficient.  Use it's implementation instead.

llvm-svn: 202099
This commit is contained in:
David Majnemer 2014-02-25 01:47:33 +00:00
parent e385d89ce6
commit 5090d9a732
1 changed files with 1 additions and 6 deletions

View File

@ -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));
}