commit 50474415607371eaaf9c99342ffb4134c7baf837
parent 1280098658c6bed84e3772cbb8bf4bf2108a0392
Author: Quentin Rameau <quinq@fifth.space>
Date: Sat, 30 Jul 2016 12:28:03 +0200
Fix scaling loop
We would get an off-by-one condition.
Thanks to sin for spotting that!
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sbm.c b/sbm.c
@@ -152,7 +152,7 @@ scale(char **suffix, uint64_t bits)
if (Bflag)
rounded /= 8;
- for (; rounded >= 1000 && unit < 5; ++unit)
+ for (; rounded >= 1000 && unit < 4; ++unit)
rounded /= 1000;
*suffix = suffixes[Bflag][unit];
return rounded;