summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2017-12-04 19:42:41 -0800
committerGabe Black <gabeblack@google.com>2017-12-06 01:14:31 +0000
commit3017314d05695207e09e87b08ca5c3cbf182c646 (patch)
tree4ba803c6c2bca546a58376c93c41d3a585154de1 /src/base
parent6e2829f5ddff3a070af8a01014fc9eec25c8f9a9 (diff)
downloadgem5-3017314d05695207e09e87b08ca5c3cbf182c646.tar.xz
base: Handle zero fill in cprintf when printing floats.
The fill_zero flag was being followed for ints, but not for floats. This makes the cprintf unit test pass. Change-Id: I4d17a3c9327aea05e0a3c81be1886c0c9256f03c Reviewed-on: https://gem5-review.googlesource.com/6322 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>
Diffstat (limited to 'src/base')
-rw-r--r--src/base/cprintf_formats.hh3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/base/cprintf_formats.hh b/src/base/cprintf_formats.hh
index 5b3b34432..253fe59cf 100644
--- a/src/base/cprintf_formats.hh
+++ b/src/base/cprintf_formats.hh
@@ -151,6 +151,9 @@ _format_float(std::ostream &out, const T &data, Format &fmt)
ios::fmtflags flags(out.flags());
+ if (fmt.fill_zero)
+ out.fill('0');
+
switch (fmt.float_format) {
case Format::scientific:
if (fmt.precision != -1) {