[PATCH] FIx alloc_var() ndigits thinko

Started by Joel Jacobsonabout 3 years ago1 messageshackers
Jump to latest
#1Joel Jacobson
joel@compiler.org

Hi,

I came across another harmless thinko in numeric.c.

It is harmless since 20/DEC_DIGITS and 40/DEC_DIGITS happens to be exactly 5 and 10 since DEC_DIGITS == 4,
but should be fixed anyway for correctness IMO.

-       alloc_var(var, 20 / DEC_DIGITS);
+       alloc_var(var, (20 + DEC_DIGITS - 1) / DEC_DIGITS);
-       alloc_var(var, 40 / DEC_DIGITS);
+       alloc_var(var, (40 + DEC_DIGITS - 1) / DEC_DIGITS);

/Joel

Attachments:

0001-fix-alloc-var-ndigits-thinko.patchapplication/octet-stream; name="=?UTF-8?Q?0001-fix-alloc-var-ndigits-thinko.patch?="Download+2-2