diff options
author | Brad King <brad.king@kitware.com> | 2018-10-03 15:38:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2018-10-03 15:38:46 (GMT) |
commit | 0b1b842e9348f554017a29f8f1bca9268e7a2a46 (patch) | |
tree | c1f74b26b8a52e38c63231be391e7d09e64c9897 | |
parent | 583060a9690d8339ecd209f8bf7d087ab4477532 (diff) | |
parent | 6d288846178a1b75e9d50578d710265516ce8f82 (diff) | |
download | CMake-0b1b842e9348f554017a29f8f1bca9268e7a2a46.zip CMake-0b1b842e9348f554017a29f8f1bca9268e7a2a46.tar.gz CMake-0b1b842e9348f554017a29f8f1bca9268e7a2a46.tar.bz2 |
Merge topic 'ctest-num-width'
6d28884617 cmCTestRunTest: Avoid float/int conversions in number width logic
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !2433
-rw-r--r-- | Source/CTest/cmCTestRunTest.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index 48a5064..10dceca 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -5,7 +5,6 @@ #include "cmConfigure.h" // IWYU pragma: keep -#include <cmath> #include <set> #include <stddef.h> #include <string> @@ -122,7 +121,12 @@ private: inline int getNumWidth(size_t n) { - return static_cast<int>(std::log10(n)) + 1; + int w = 1; + while (n >= 10) { + n /= 10; + ++w; + } + return w; } #endif |