Move MinAlign to MathExtras.h.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@43944 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Duncan Sands
2007-11-09 13:41:39 +00:00
parent 20a990e16e
commit fd617d0143
5 changed files with 8 additions and 31 deletions

View File

@ -358,6 +358,13 @@ int IsNAN(double d);
int IsInf(float f);
int IsInf(double d);
/// MinAlign - A and B are either alignments or offsets. Return the minimum
/// alignment that may be assumed after adding the two together.
static inline unsigned MinAlign(unsigned A, unsigned B) {
// The largest power of 2 that divides both A and B.
return (A | B) & -(A | B);
}
} // End llvm namespace
#endif