r202099 - AST: Simplify CharUnits::alignmentAtOffset
David Majnemer
david.majnemer at gmail.com
Mon Feb 24 17:47:33 PST 2014
Author: majnemer
Date: Mon Feb 24 19:47:33 2014
New Revision: 202099
URL: http://llvm.org/viewvc/llvm-project?rev=202099&view=rev
Log:
AST: Simplify CharUnits::alignmentAtOffset
CharUnits::alignmentAtOffset is equivalent to llvm::MinAlign but
slightly less efficient. Use it's implementation instead.
Modified:
cfe/trunk/include/clang/AST/CharUnits.h
Modified: cfe/trunk/include/clang/AST/CharUnits.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CharUnits.h?rev=202099&r1=202098&r2=202099&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CharUnits.h (original)
+++ cfe/trunk/include/clang/AST/CharUnits.h Mon Feb 24 19:47:33 2014
@@ -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));
}
More information about the cfe-commits
mailing list