[llvm-commits] [llvm] r145249 - /llvm/trunk/include/llvm/ADT/APInt.h
Benjamin Kramer
benny.kra at googlemail.com
Mon Nov 28 09:10:26 PST 2011
On 28.11.2011, at 18:06, Eli Friedman wrote:
> On Mon, Nov 28, 2011 at 8:56 AM, Benjamin Kramer
> <benny.kra at googlemail.com> wrote:
>> Author: d0k
>> Date: Mon Nov 28 10:56:38 2011
>> New Revision: 145249
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=145249&view=rev
>> Log:
>> Handle more cases in APInt::getLowBitsSet's fast path.
>>
>> Modified:
>> llvm/trunk/include/llvm/ADT/APInt.h
>>
>> Modified: llvm/trunk/include/llvm/ADT/APInt.h
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=145249&r1=145248&r2=145249&view=diff
>> ==============================================================================
>> --- llvm/trunk/include/llvm/ADT/APInt.h (original)
>> +++ llvm/trunk/include/llvm/ADT/APInt.h Mon Nov 28 10:56:38 2011
>> @@ -497,8 +497,8 @@
>> if (loBitsSet == APINT_BITS_PER_WORD)
>> return APInt(numBits, -1ULL);
>
> Did you mean to delete these two lines?
Yes, I should've made clear that this change supersedes the old path, loBitsSet is always less or equal numBits.
-Ben
>
> -Eli
>
>> // For small values, return quickly.
>> - if (numBits < APINT_BITS_PER_WORD)
>> - return APInt(numBits, (1ULL << loBitsSet) - 1);
>> + if (loBitsSet <= APINT_BITS_PER_WORD)
>> + return APInt(numBits, -1ULL >> (APINT_BITS_PER_WORD - loBitsSet));
>> return getAllOnesValue(numBits).lshr(numBits - loBitsSet);
>> }
More information about the llvm-commits
mailing list