From 30b795fd106b190d21b800e45756e2794b53f05f Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Tue, 23 Oct 2007 00:08:58 -0700 Subject: 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. --- nasmlib.c | 6 ++++-- 1 file 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; } -- cgit v1.2.1