From 32123aec2b389eb91036ab9c509cf452d33cb640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Kj=C3=A4ll?= Date: Mon, 25 Apr 2016 20:01:06 +0200 Subject: [PATCH] made logarithm function for calculating column widths in the output be more generic --- apps/esmtool/esmtool.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/apps/esmtool/esmtool.cpp b/apps/esmtool/esmtool.cpp index be90afec3..c6d6ad6e3 100644 --- a/apps/esmtool/esmtool.cpp +++ b/apps/esmtool/esmtool.cpp @@ -442,12 +442,8 @@ int clone(Arguments& info) size_t recordCount = info.data.mRecords.size(); int digitCount = 1; // For a nicer output - if (recordCount > 9) ++digitCount; - if (recordCount > 99) ++digitCount; - if (recordCount > 999) ++digitCount; - if (recordCount > 9999) ++digitCount; - if (recordCount > 99999) ++digitCount; - if (recordCount > 999999) ++digitCount; + if (recordCount > 0) + digitCount = (int)log10(recordCount) + 1; std::cout << "Loaded " << recordCount << " records:" << std::endl << std::endl;