Skip to content
Snippets Groups Projects
Commit 57350682 authored by Alexander Beischl's avatar Alexander Beischl
Browse files

Fix function ToInt: conversion from string to int did not take care of the '.' dot.

parent 1df53280
No related branches found
No related tags found
No related merge requests found
......@@ -8,7 +8,12 @@ using namespace aria::csv;
int64_t ToInt(std::string_view s) {
int64_t result = 0;
for (auto c : s) result = result * 10 + (c - '0');
for (auto c : s)
if (c != '.') // Skip the dot.
result = result * 10 + (c - '0');
// Skipping the dot relies on the formatting that there are exactly two
// digits after the decimal point. Luckily, this is the case in our input
// file.
return result;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment