Skip to content

Commit

Permalink
Fixing the infint parser (from "Changing the USEINFINT default value …
Browse files Browse the repository at this point in the history
…to enable large integer computations") updated to stop on eof : missing first char
  • Loading branch information
laurentnoe committed May 6, 2022
1 parent 96508b4 commit 516b2af
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/infint.hh
Original file line number Diff line number Diff line change
Expand Up @@ -1315,11 +1315,10 @@ template<typename T> inline std::istream& operator>>(std::istream &s, infint<T>
{//PROFILED_SCOPE
std::string str;
char c = ' ';
if (s.get(c) && c == '-') {
str.push_back(c);
}
while (s.get(c) && (c >= '0') && (c <= '9')){
bool first = true;
while (s.get(c) && ((first && (c == '-')) || ((c >= '0') && (c <= '9')))) {
str.push_back(c);
first = false;
}
s.unget();
v.fromString(str);
Expand Down

0 comments on commit 516b2af

Please sign in to comment.