[llvm-commits] [llvm] r140158 - /llvm/trunk/lib/Support/APInt.cpp

Douglas Gregor dgregor at apple.com
Tue Sep 20 11:34:30 PDT 2011


On Sep 20, 2011, at 11:33 AM, Benjamin Kramer wrote:

> On Tue, Sep 20, 2011 at 11:11, Douglas Gregor <dgregor at apple.com> wrote:
>> Author: dgregor
>> Date: Tue Sep 20 13:11:52 2011
>> New Revision: 140158
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=140158&view=rev
>> Log:
>> Eliminate sign-comparison warnings in APInt
>> 
>> Modified:
>>    llvm/trunk/lib/Support/APInt.cpp
>> 
>> Modified: llvm/trunk/lib/Support/APInt.cpp
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=140158&r1=140157&r2=140158&view=diff
>> ==============================================================================
>> --- llvm/trunk/lib/Support/APInt.cpp (original)
>> +++ llvm/trunk/lib/Support/APInt.cpp Tue Sep 20 13:11:52 2011
>> @@ -54,12 +54,14 @@
>>       return r;
>> 
>>     r = cdigit - 'A';
>> -    if (r <= radix - 11U)
>> +    if (r <= unsigned(radix - 11U))
>>       return r + 10;
>> 
>>     r = cdigit - 'a';
>> -    if (r <= radix - 11U)
>> +    if (r <= unsigned(radix - 11U))
>>       return r + 10;
>> +
>> +    radix = 10;
>>   }
> 
> I added the U suffixes that should have fixed those warnings already
> by making the whole expression unsigned.

… and I didn't even notice them there. Backing out my silliness, sorry!

	- Doug



More information about the llvm-commits mailing list