[llvm-commits] [llvm] r145249 - /llvm/trunk/include/llvm/ADT/APInt.h

Eli Friedman eli.friedman at gmail.com
Mon Nov 28 09:06:13 PST 2011


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?

-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