diff options
author | 2023-07-11 17:43:59 +0200 | |
---|---|---|
committer | 2023-07-11 08:43:59 -0700 | |
commit | f30799b6f0ffe2a31aa388856c9b66835b384257 (patch) | |
tree | b0c8ad728b43c17b34ef9c994ed6f730a79f001b /Source/Utils/Parser/ParserUtils.cpp | |
parent | 6bef28b32118a1b1ef236a0e1bce22c1bad368d8 (diff) | |
download | WarpX-f30799b6f0ffe2a31aa388856c9b66835b384257.tar.gz WarpX-f30799b6f0ffe2a31aa388856c9b66835b384257.tar.zst WarpX-f30799b6f0ffe2a31aa388856c9b66835b384257.zip |
Clang-tidy CI test: add almost all missing bugprone clang-tidy checks (#4064)
* add almost all missing bugprone checks in clang-tidy CI test
* disable bugprone-misplaced-widening-cast check
* fix issue of type bugprone-integer-division
Diffstat (limited to 'Source/Utils/Parser/ParserUtils.cpp')
-rw-r--r-- | Source/Utils/Parser/ParserUtils.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Source/Utils/Parser/ParserUtils.cpp b/Source/Utils/Parser/ParserUtils.cpp index fd56d1e3c..de4723241 100644 --- a/Source/Utils/Parser/ParserUtils.cpp +++ b/Source/Utils/Parser/ParserUtils.cpp @@ -43,7 +43,8 @@ namespace { // (2.0*(numeric_limits<int>::max()/2+1)) converts numeric_limits<int>::max()+1 to a real ensuring accuracy to all digits // This accepts x = 2**31-1 but rejects 2**31. using namespace amrex::literals; - constexpr amrex::Real max_range = (2.0_rt*static_cast<amrex::Real>(std::numeric_limits<int_type>::max()/2+1)); + constexpr int_type half_max_plus_one = std::numeric_limits<int_type>::max()/2+1; + constexpr amrex::Real max_range = (2.0_rt*static_cast<amrex::Real>(half_max_plus_one)); if (x < max_range) { if (std::ceil(x) >= std::numeric_limits<int_type>::min()) { result = static_cast<int_type>(x); |