summaryrefslogtreecommitdiffstats
path: root/Source/CTest/cmCTestRunTest.h
diff options
context:
space:
mode:
authorMichael Wegner <michael_wegner@apple.com>2018-09-08 22:36:00 (GMT)
committerBrad King <brad.king@kitware.com>2018-09-25 12:20:57 (GMT)
commit02c5091c905964b529020070b4b24616d8a3fbd8 (patch)
treee622aaff1153d95535225348da67414994134e38 /Source/CTest/cmCTestRunTest.h
parent6a285bb737b904f33de287eede1eaec9928e3e3d (diff)
downloadCMake-02c5091c905964b529020070b4b24616d8a3fbd8.zip
CMake-02c5091c905964b529020070b4b24616d8a3fbd8.tar.gz
CMake-02c5091c905964b529020070b4b24616d8a3fbd8.tar.bz2
cmCTestRunTest: Simplify number width computation
Use a real logarithm implementation.
Diffstat (limited to 'Source/CTest/cmCTestRunTest.h')
-rw-r--r--Source/CTest/cmCTestRunTest.h10
1 files changed, 2 insertions, 8 deletions
diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h
index 7e80157..8e24834 100644
--- a/Source/CTest/cmCTestRunTest.h
+++ b/Source/CTest/cmCTestRunTest.h
@@ -5,6 +5,7 @@
#include "cmConfigure.h" // IWYU pragma: keep
+#include <cmath>
#include <set>
#include <stddef.h>
#include <string>
@@ -118,14 +119,7 @@ private:
inline int getNumWidth(size_t n)
{
- int numWidth = 1;
- if (n >= 10) {
- numWidth = 2;
- }
- if (n >= 100) {
- numWidth = 3;
- }
- return numWidth;
+ return static_cast<int>(std::log10(n)) + 1;
}
#endif