[llvm-commits] [llvm] r82322 - in /llvm/trunk: include/llvm/ADT/StringRef.h lib/Support/StringRef.cpp

Chris Lattner sabre at nondot.org
Sun Sep 20 15:56:50 PDT 2009


On Sep 20, 2009, at 2:20 PM, Daniel Dunbar wrote:

>> +  }
>
> I think this would be simpler as:
> --
> if (Radix == 0) {
>  if (Str.startswith("0x")) {
>    Str = Str.substr(2);
>    Radix = 16;
>  }  else if (Str.startswith("0b")) {
>    Str = Str.substr(2);
>    Radix = 2;
>  } else if (Str.startswith("0"))
>    Radix = 8;
>  else
>    Radix = 10;
> }
> --
> and let the optimizer do the thinking.

Done, thanks.

-Chris



More information about the llvm-commits mailing list