MCPcopy Create free account
hub / github.com/ablab/spades / GetAutoSenseRadix

Function GetAutoSenseRadix

ext/src/llvm/StringRef.cpp:389–414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

387}
388
389static unsigned GetAutoSenseRadix(StringRef &Str) {
390 if (Str.empty())
391 return 10;
392
393 if (Str.startswith("0x") || Str.startswith("0X")) {
394 Str = Str.substr(2);
395 return 16;
396 }
397
398 if (Str.startswith("0b") || Str.startswith("0B")) {
399 Str = Str.substr(2);
400 return 2;
401 }
402
403 if (Str.startswith("0o")) {
404 Str = Str.substr(2);
405 return 8;
406 }
407
408 if (Str[0] == '0' && Str.size() > 1 && isDigit(Str[1])) {
409 Str = Str.substr(1);
410 return 8;
411 }
412
413 return 10;
414}
415
416bool llvm::consumeUnsignedInteger(StringRef &Str, unsigned Radix,
417 unsigned long long &Result) {

Callers 2

getAsIntegerMethod · 0.85

Calls 5

isDigitFunction · 0.85
startswithMethod · 0.80
emptyMethod · 0.45
substrMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected