diff options
| author | Andreas Schwab | 2017-03-08 09:36:26 +0100 |
|---|---|---|
| committer | Andreas Schwab | 2017-03-08 09:37:07 +0100 |
| commit | 45541e4611b1ec4cd727f26dac27705b4a468bfc (patch) | |
| tree | b77dadf1f09d3077bc0bfd081a08a4ed1668c235 /src | |
| parent | be924d77e93c921ab2c2563f1045b6dbe49c611e (diff) | |
| download | emacs-45541e4611b1ec4cd727f26dac27705b4a468bfc.tar.gz emacs-45541e4611b1ec4cd727f26dac27705b4a468bfc.zip | |
* data.c (cons_to_unsigned, cons_to_signed, Fstring_to_number): Reorder
comparisons that are written backward.
Diffstat (limited to 'src')
| -rw-r--r-- | src/data.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/data.c b/src/data.c index c480ed2068a..b3234a79b88 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2564,13 +2564,13 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max) | |||
| 2564 | uintmax_t val; | 2564 | uintmax_t val; |
| 2565 | if (INTEGERP (c)) | 2565 | if (INTEGERP (c)) |
| 2566 | { | 2566 | { |
| 2567 | valid = 0 <= XINT (c); | 2567 | valid = XINT (c) >= 0; |
| 2568 | val = XINT (c); | 2568 | val = XINT (c); |
| 2569 | } | 2569 | } |
| 2570 | else if (FLOATP (c)) | 2570 | else if (FLOATP (c)) |
| 2571 | { | 2571 | { |
| 2572 | double d = XFLOAT_DATA (c); | 2572 | double d = XFLOAT_DATA (c); |
| 2573 | if (0 <= d && d < 1.0 + max) | 2573 | if (d >= 0 && d < 1.0 + max) |
| 2574 | { | 2574 | { |
| 2575 | val = d; | 2575 | val = d; |
| 2576 | valid = val == d; | 2576 | valid = val == d; |
| @@ -2624,7 +2624,7 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max) | |||
| 2624 | else if (FLOATP (c)) | 2624 | else if (FLOATP (c)) |
| 2625 | { | 2625 | { |
| 2626 | double d = XFLOAT_DATA (c); | 2626 | double d = XFLOAT_DATA (c); |
| 2627 | if (min <= d && d < 1.0 + max) | 2627 | if (d >= min && d < 1.0 + max) |
| 2628 | { | 2628 | { |
| 2629 | val = d; | 2629 | val = d; |
| 2630 | valid = val == d; | 2630 | valid = val == d; |
| @@ -2634,7 +2634,7 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max) | |||
| 2634 | { | 2634 | { |
| 2635 | intmax_t top = XINT (XCAR (c)); | 2635 | intmax_t top = XINT (XCAR (c)); |
| 2636 | Lisp_Object rest = XCDR (c); | 2636 | Lisp_Object rest = XCDR (c); |
| 2637 | if (INTMAX_MIN >> 24 >> 16 <= top && top <= INTMAX_MAX >> 24 >> 16 | 2637 | if (top >= INTMAX_MIN >> 24 >> 16 && top <= INTMAX_MAX >> 24 >> 16 |
| 2638 | && CONSP (rest) | 2638 | && CONSP (rest) |
| 2639 | && NATNUMP (XCAR (rest)) && XFASTINT (XCAR (rest)) < 1 << 24 | 2639 | && NATNUMP (XCAR (rest)) && XFASTINT (XCAR (rest)) < 1 << 24 |
| 2640 | && NATNUMP (XCDR (rest)) && XFASTINT (XCDR (rest)) < 1 << 16) | 2640 | && NATNUMP (XCDR (rest)) && XFASTINT (XCDR (rest)) < 1 << 16) |
| @@ -2643,7 +2643,7 @@ cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max) | |||
| 2643 | val = top << 24 << 16 | mid << 16 | XFASTINT (XCDR (rest)); | 2643 | val = top << 24 << 16 | mid << 16 | XFASTINT (XCDR (rest)); |
| 2644 | valid = true; | 2644 | valid = true; |
| 2645 | } | 2645 | } |
| 2646 | else if (INTMAX_MIN >> 16 <= top && top <= INTMAX_MAX >> 16) | 2646 | else if (top >= INTMAX_MIN >> 16 && top <= INTMAX_MAX >> 16) |
| 2647 | { | 2647 | { |
| 2648 | if (CONSP (rest)) | 2648 | if (CONSP (rest)) |
| 2649 | rest = XCAR (rest); | 2649 | rest = XCAR (rest); |
| @@ -2700,7 +2700,7 @@ If the base used is not 10, STRING is always parsed as an integer. */) | |||
| 2700 | else | 2700 | else |
| 2701 | { | 2701 | { |
| 2702 | CHECK_NUMBER (base); | 2702 | CHECK_NUMBER (base); |
| 2703 | if (! (2 <= XINT (base) && XINT (base) <= 16)) | 2703 | if (! (XINT (base) >= 2 && XINT (base) <= 16)) |
| 2704 | xsignal1 (Qargs_out_of_range, base); | 2704 | xsignal1 (Qargs_out_of_range, base); |
| 2705 | b = XINT (base); | 2705 | b = XINT (base); |
| 2706 | } | 2706 | } |