diff options
author | Hans Goudey <h.goudey@me.com> | 2021-11-23 20:49:45 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-11-23 20:49:45 +0300 |
commit | 62b50c612f68694662717acb11f3c0789159a978 (patch) | |
tree | fafa8007047b6ac6d5ca72cb65e7cdfbfa5ae49e /source/blender/editors | |
parent | c09e8a35904d5c58882cbe93c5086e5f2450c80e (diff) |
Cleanup: Else after return, other simplifications
`std::stringstream` already returns a `std::string`, and there is no
particular reason to use short here instead of int.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_node/node_draw.cc | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/source/blender/editors/space_node/node_draw.cc b/source/blender/editors/space_node/node_draw.cc index 1aa6ec4e56c..1d62321cae3 100644 --- a/source/blender/editors/space_node/node_draw.cc +++ b/source/blender/editors/space_node/node_draw.cc @@ -1664,24 +1664,22 @@ static std::string node_get_execution_time_label(const SpaceNode *snode, const b if (exec_time_us == 0) { return std::string("-"); } - else if (exec_time_us < 100) { + if (exec_time_us < 100) { return std::string("< 0.1 ms"); } - else { - short precision = 0; - /* Show decimal if value is below 1ms */ - if (exec_time_us < 1000) { - precision = 2; - } - else if (exec_time_us < 10000) { - precision = 1; - } - std::stringstream stream; - stream << std::fixed << std::setprecision(precision) << (exec_time_us / 1000.0f); - return std::string(stream.str() + " ms"); + int precision = 0; + /* Show decimal if value is below 1ms */ + if (exec_time_us < 1000) { + precision = 2; } - return std::string(""); + else if (exec_time_us < 10000) { + precision = 1; + } + + std::stringstream stream; + stream << std::fixed << std::setprecision(precision) << (exec_time_us / 1000.0f); + return stream.str() + " ms"; } struct NodeExtraInfoRow { |