| 354 | } |
| 355 | |
| 356 | long long parseLong(const char* s, const char* e, int base) |
| 357 | { |
| 358 | unsigned long long res = 0; |
| 359 | for(const char *p = s; p < e; p++) |
| 360 | { |
| 361 | int digit = ((*p >= '0' && *p <= '9') ? *p - '0' : (*p & ~0x20) - 'A' + 10); |
| 362 | if(digit < 0 || digit >= base) |
| 363 | ThrowError(p, "ERROR: digit %d is not allowed in base %d", digit, base); |
| 364 | res = res * base + digit; |
| 365 | } |
| 366 | return res; |
| 367 | } |
| 368 | |
| 369 | double parseDouble(const char *str) |
| 370 | { |
no test coverage detected