Skip to content

Commit 23f0dc8

Browse files
committed
[vpr][route][crr] remove double from acceptable values for cell
1 parent 83a3aef commit 23f0dc8

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ Cell DataFrameProcessor::parse_csv_cell(const std::string& value) {
299299
// Try to parse as number
300300
try {
301301
size_t pos;
302-
double num = std::stod(trimmed, &pos);
302+
int num = std::stoi(trimmed, &pos);
303303
if (pos == trimmed.length()) {
304304
return Cell(num);
305305
}

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

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,11 @@ namespace crrgenerator {
1212
struct Cell {
1313
enum class Type { EMPTY,
1414
STRING,
15-
INTEGER,
16-
DOUBLE };
15+
INTEGER };
1716

1817
Type type = Type::EMPTY;
1918
std::string string_value;
2019
int64_t int_value = 0;
21-
double double_value = 0.0;
2220

2321
Cell() = default;
2422
explicit Cell(const std::string& value)
@@ -27,34 +25,21 @@ struct Cell {
2725
explicit Cell(int64_t value)
2826
: type(Type::INTEGER)
2927
, int_value(value) {}
30-
explicit Cell(double value)
31-
: type(Type::DOUBLE)
32-
, double_value(value) {}
3328

3429
bool is_empty() const { return type == Type::EMPTY; }
3530
bool is_string() const { return type == Type::STRING; }
3631
bool is_integer() const { return type == Type::INTEGER; }
37-
bool is_double() const { return type == Type::DOUBLE; }
38-
bool is_number() const { return is_integer() || is_double(); }
32+
bool is_number() const { return is_integer(); }
3933

4034
int64_t as_int() const {
4135
if (is_integer()) return int_value;
42-
if (is_double()) return static_cast<int64_t>(double_value);
4336
if (is_string()) return std::stoll(string_value);
4437
return 0;
4538
}
4639

47-
double as_double() const {
48-
if (is_double()) return double_value;
49-
if (is_integer()) return static_cast<double>(int_value);
50-
if (is_string()) return std::stod(string_value);
51-
return 0.0;
52-
}
53-
5440
std::string as_string() const {
5541
if (is_string()) return string_value;
5642
if (is_integer()) return std::to_string(int_value);
57-
if (is_double()) return std::to_string(double_value);
5843
return "";
5944
}
6045
};

0 commit comments

Comments
 (0)