diff --git a/util/Reporting.cpp b/util/Reporting.cpp index 831c8585..a965ba88 100644 --- a/util/Reporting.cpp +++ b/util/Reporting.cpp @@ -465,13 +465,10 @@ bool ReportBitsCollisions( uint64_t nbH, int * collcounts, int minBits, int maxB } if (verbose) { - const char * spaces = " "; int i_maxCollDevExp = (int)round(maxCollDevExp); spacelen -= printf("Worst is %2i bits: %i/%i ", maxCollDevBits, maxCollDevNb, i_maxCollDevExp); if (spacelen < 0) { spacelen = 0; - } else if (spacelen > (int)strlen(spaces)) { - spacelen = strlen(spaces); } if (maxCollDev >= 999.95) { @@ -479,11 +476,11 @@ bool ReportBitsCollisions( uint64_t nbH, int * collcounts, int minBits, int maxB } if (!isfinite(maxCollDev)) { - printf("%.*s(------) ", spacelen, spaces); + printf("%.*s(------) ", spacelen, g_manyspaces); } else if (maxCollDev < 9.0) { - printf("%.*s(%5.3fx) ", spacelen, spaces, maxCollDev); + printf("%.*s(%5.3fx) ", spacelen, g_manyspaces, maxCollDev); } else { - printf("%.*s(%#.4gx) ", spacelen, spaces, maxCollDev); + printf("%.*s(%#.4gx) ", spacelen, g_manyspaces, maxCollDev); } if (drawDiagram) { diff --git a/util/TestGlobals.cpp b/util/TestGlobals.cpp index b886787f..681f9283 100644 --- a/util/TestGlobals.cpp +++ b/util/TestGlobals.cpp @@ -78,3 +78,9 @@ const char * g_failstr = "*********FAIL*********\n"; uint32_t g_log2pValueCounts[COUNT_MAX_PVALUE + 2]; uint32_t g_testPass, g_testFail; std::vector> g_testFailures; + +//-------- +// A string with 128 spaces, useful for aligning text outputs +const char * g_manyspaces = + " " \ + " "; diff --git a/util/TestGlobals.h b/util/TestGlobals.h index 637c78fa..a0bc5136 100644 --- a/util/TestGlobals.h +++ b/util/TestGlobals.h @@ -36,6 +36,9 @@ extern seed_t g_seed; // What each test suite prints upon failure extern const char * g_failstr; +// A string with 128 spaces, used for aligning text outputs +extern const char * g_manyspaces; + // By rights, the HAVE_HASHINFO #define shouldn't exist, but C++11 // doesn't allow forward declaration of class enums (enum classes, // yes, but not class enums) for no good reason, and we definitely