changeset 325:40ce4106f4ad

Add special case handling for f_prec == 0 && val == 0. Fixes several test cases.
author Matti Hamalainen <ccr@tnsp.org>
date Tue, 23 Feb 2016 12:16:12 +0200
parents 0084618812ee
children 75b22d6f8a71
files th_printf1.c
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/th_printf1.c	Tue Feb 23 12:15:51 2016 +0200
+++ b/th_printf1.c	Tue Feb 23 12:16:12 2016 +0200
@@ -39,6 +39,11 @@
     // Render the value to a string in buf (reversed)
     TH_PFUNC_TYPE_U val = pval;
 #endif
+
+    // Special case for value of 0 and precision 0
+    if (val == 0 && f_prec == 0)
+        return 0;
+
     do
     {
         TH_PFUNC_TYPE_U digit = val % radix;