A utility function that converts a character to a digit.
| 48 | |
| 49 | /// A utility function that converts a character to a digit. |
| 50 | inline static unsigned getDigit(char cdigit, uint8_t radix) { |
| 51 | unsigned r; |
| 52 | |
| 53 | if (radix == 16 || radix == 36) { |
| 54 | r = cdigit - '0'; |
| 55 | if (r <= 9) |
| 56 | return r; |
| 57 | |
| 58 | r = cdigit - 'A'; |
| 59 | if (r <= radix - 11U) |
| 60 | return r + 10; |
| 61 | |
| 62 | r = cdigit - 'a'; |
| 63 | if (r <= radix - 11U) |
| 64 | return r + 10; |
| 65 | |
| 66 | radix = 10; |
| 67 | } |
| 68 | |
| 69 | r = cdigit - '0'; |
| 70 | if (r < radix) |
| 71 | return r; |
| 72 | |
| 73 | return -1U; |
| 74 | } |
| 75 | |
| 76 | |
| 77 | void APInt::initSlowCase(uint64_t val, bool isSigned) { |