Skip to content

Commit 7d1e758

Browse files
committed
[vpr][route][crr] fix parse_csv_cell
1 parent a1859aa commit 7d1e758

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

vpr/src/route/rr_graph_generation/tileable_rr_graph/crr_generator/data_frame_processor.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,15 +296,17 @@ Cell DataFrameProcessor::parse_csv_cell(const std::string& value) {
296296
return Cell(); // Empty cell
297297
}
298298

299-
// Try to parse as number
300-
try {
301-
size_t pos;
302-
int num = std::stoi(trimmed, &pos);
303-
if (pos == trimmed.length()) {
304-
return Cell(num);
299+
// Check if all characters are digits
300+
bool is_integer = true;
301+
for (char c : trimmed) {
302+
if (!std::isdigit(static_cast<unsigned char>(c))) {
303+
is_integer = false;
304+
break;
305305
}
306-
} catch (...) {
307-
// Not a number, treat as string
306+
}
307+
308+
if (is_integer) {
309+
return Cell(std::stoi(trimmed));
308310
}
309311

310312
return Cell(trimmed);

0 commit comments

Comments
 (0)