[llvm-commits] [llvm] r160223 - in /llvm/trunk/include/llvm/ADT: APInt.h APSInt.h

Eric Christopher echristo at apple.com
Tue Jul 17 11:12:01 PDT 2012


On Jul 14, 2012, at 11:26 PM, Duncan Sands <baldrick at free.fr> wrote:

> Hi Eric,
> 
>> Move IsSameValue from clang's ASTImporter to be methods on the
>> APInt/APSInt classes.
> ...
>> --- llvm/trunk/include/llvm/ADT/APInt.h (original)
>> +++ llvm/trunk/include/llvm/ADT/APInt.h Sat Jul 14 19:23:36 2012
>> @@ -511,6 +511,18 @@
>>      return getAllOnesValue(numBits).lshr(numBits - loBitsSet);
>>    }
>> 
>> +  /// \brief Determine if two APInts have the same value, after zero-extending
>> +  /// one of them (if needed!) to ensure that the bit-widths match.
>> +  static bool isSameValue(const APInt &I1, const APInt &I2) {
> 
> maybe this should be called isSameZExtValue or isSameUnsignedValue since it is
> really an unsigned operation (eg you can easily imagine a signed version of
> this).

Hmm.. I thought about that, but figured the code under APSInt would largely
cover the same sort of situation. It can probably be extended as we've got
a need though.

-eric



More information about the llvm-commits mailing list