Skip to content

Commit

Permalink
FIX: tinny code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 5, 2022
1 parent e3a200a commit 1093ae1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/l-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -365,11 +365,11 @@ bad_hex: Trap0(RE_INVALID_CHARS);
}
*bp = 0;

// Too many digits?
// Count number of digits
len = (REBCNT)(bp - &buf[0]);
if (neg) len--;
if (len > 19) return 0;
if (len > 0) {
if (len > 19) return 0; // Too many digits
// Convert, check, and return:
errno = 0;
n = CHR_TO_INT(buf);
Expand Down
7 changes: 7 additions & 0 deletions src/tests/units/make-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ Rebol [
--assert 0 = to integer! "0"
--assert 0 = to integer! "00"
--assert 0 = to integer! "00000000000"
--assert 0 = to integer! "-0"
--assert 0 = to integer! "-00"
--assert 0 = to integer! "-00000000000"
--assert 0 = to integer! "+0"
--assert 0 = to integer! "+00"
--assert 0 = to integer! "+00000000000"
--assert 0 = to integer! "000'000'000"

===end-group===

Expand Down

0 comments on commit 1093ae1

Please sign in to comment.