diff options
author | Rob Landley <rob@landley.net> | 2018-03-20 19:13:03 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2018-03-20 19:13:03 -0500 |
commit | 279fe0b437f777c1133d8421a94977a9f8867b12 (patch) | |
tree | 48a15a9e1e6bf7c59e0eb66a00434f3cc29d15a8 | |
parent | aa265ebff4fd94b1bfa152a116d6d5fa1971b727 (diff) | |
download | toybox-279fe0b437f777c1133d8421a94977a9f8867b12.tar.gz |
Minghui Liu pointed out that the b and c suffixes were reported as errors.
-rw-r--r-- | lib/lib.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -302,10 +302,11 @@ long long atolx(char *numstr) if (c != numstr && *c && (end = strchr(suffixes, tolower(*c)))) { int shift = end-suffixes-2; + ++c; if (shift==-1) val *= 2; - if (!shift) val *= 512; + else if (!shift) val *= 512; else if (shift>0) { - if (toupper(*++c)=='d') while (shift--) val *= 1000; + if (toupper(*c)=='d') while (shift--) val *= 1000; else val *= 1LL<<(shift*10); } } |