mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-20 21:40:15 +08:00
cmCTestRunTest: Simplify number width computation
Use a real logarithm implementation.
This commit is contained in:

committed by
Brad King

parent
6a285bb737
commit
02c5091c90
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "cmConfigure.h" // IWYU pragma: keep
|
#include "cmConfigure.h" // IWYU pragma: keep
|
||||||
|
|
||||||
|
#include <cmath>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -118,14 +119,7 @@ private:
|
|||||||
|
|
||||||
inline int getNumWidth(size_t n)
|
inline int getNumWidth(size_t n)
|
||||||
{
|
{
|
||||||
int numWidth = 1;
|
return static_cast<int>(std::log10(n)) + 1;
|
||||||
if (n >= 10) {
|
|
||||||
numWidth = 2;
|
|
||||||
}
|
|
||||||
if (n >= 100) {
|
|
||||||
numWidth = 3;
|
|
||||||
}
|
|
||||||
return numWidth;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user