|
|
|
@ -46,7 +46,7 @@ bool isDigit(char c) { |
|
|
|
|
return val >= 0 && val < 10; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
vector<uint64> parseInts(const string &data) { |
|
|
|
|
vector<uint64> parseUInts(const string &data) { |
|
|
|
|
vector<uint64> result; |
|
|
|
|
|
|
|
|
|
uint64 value = 0; |
|
|
|
@ -66,5 +66,34 @@ vector<uint64> parseInts(const string &data) { |
|
|
|
|
if (readingInt) |
|
|
|
|
result.push_back(value); |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
vector<int64> parseInts(const string &data) { |
|
|
|
|
vector<int64> result; |
|
|
|
|
|
|
|
|
|
int64 value = 0; |
|
|
|
|
bool readingInt = false; |
|
|
|
|
bool negative = false; |
|
|
|
|
|
|
|
|
|
for (const char c : data){ |
|
|
|
|
uint8_t digit; |
|
|
|
|
if (isDigit(c, digit)) { |
|
|
|
|
value = value * 10 + digit; |
|
|
|
|
readingInt = true; |
|
|
|
|
} else if (!readingInt && c == '-') { |
|
|
|
|
negative = true; |
|
|
|
|
} else if (readingInt){ |
|
|
|
|
readingInt = false; |
|
|
|
|
result.push_back(value * (negative ? -1 : 1)); |
|
|
|
|
value = 0; |
|
|
|
|
negative = false; |
|
|
|
|
} else { |
|
|
|
|
negative = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (readingInt) |
|
|
|
|
result.push_back(value); |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
|
} |