summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-23 00:08:58 -0700
committerH. Peter Anvin <hpa@zytor.com>2007-10-23 00:08:58 -0700
commit30b795fd106b190d21b800e45756e2794b53f05f (patch)
tree49a017e807b5cea12f0a565df70bcd4c27f82dfb
parent50620f4a3f78dc8fb51f76633aeeb962e29093d9 (diff)
downloadnasm-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.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/nasmlib.c b/nasmlib.c
index edc390d1..ee947c23 100644
--- a/nasmlib.c
+++ b/nasmlib.c
@@ -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;
}