diff options
author | H. Peter Anvin <hpa@zytor.com> | 2007-10-23 00:08:58 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2007-10-23 00:08:58 -0700 |
commit | 30b795fd106b190d21b800e45756e2794b53f05f (patch) | |
tree | 49a017e807b5cea12f0a565df70bcd4c27f82dfb | |
parent | 50620f4a3f78dc8fb51f76633aeeb962e29093d9 (diff) | |
download | nasm-30b795fd106b190d21b800e45756e2794b53f05f.tar.gz |
Slightly simplify the radix-detection code
(pradix && pradix > sradix) etc. is unnecessary since pradix and
sradix cannot be negative, so zero is always the smallest value.
Put in a comment explaining why making the default radix == 10 doesn't
need any additional error checking.
-rw-r--r-- | nasmlib.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -263,13 +263,15 @@ int64_t readnum(char *str, bool *error) if ((sradix = radix_letter(q[-1])) != 0) slen = 1; - if (pradix && pradix > sradix) { + if (pradix > sradix) { radix = pradix; r += plen; - } else if (sradix && sradix > pradix) { + } else if (sradix > pradix) { radix = sradix; q -= slen; } else { + /* Either decimal, or invalid -- if invalid, we'll trip up + further down. */ radix = 10; } |