]> git.eshelyaron.com Git - emacs.git/commitdiff
* ccl.c (ccl_driver): Redo slightly to avoid the need for 'unsigned'.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 May 2011 06:58:38 +0000 (23:58 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 May 2011 06:58:38 +0000 (23:58 -0700)
src/ChangeLog
src/ccl.c

index f49250b6a35982b391c43b2224dd8517ea08a51a..9f9cf401e96b6397e0220c9511bfd036018b9cef 100644 (file)
@@ -1,5 +1,7 @@
 2011-05-23  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * ccl.c (ccl_driver): Redo slightly to avoid the need for 'unsigned'.
+
        ccl: add integer overflow checks
        * ccl.c (CCL_CODE_MAX, GET_CCL_RANGE, GET_CCL_CODE, GET_CCL_INT):
        (IN_INT_RANGE): New macros.
index d66a61b713d7ef241b84f102ede0ede0a264cbd9..98b060522a42b913130114db43a0bdbecdb23f58 100644 (file)
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -946,7 +946,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
        case CCL_SetArray:      /* CCCCCCCCCCCCCCCCCCCCRRRrrrXXXXX */
          i = reg[RRR];
          j = field1 >> 3;
-         if ((unsigned int) i < j)
+         if (0 <= i && i < j)
            GET_CCL_INT (reg[rrr], ccl_prog, ic + i);
          ic += j;
          break;
@@ -997,7 +997,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
        case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */
          i = reg[rrr];
          GET_CCL_INT (j, ccl_prog, ic);
-         if ((unsigned int) i < j)
+         if (0 <= i && i < j)
            {
              GET_CCL_INT (i, ccl_prog, ic + 1 + i);
              CCL_WRITE_CHAR (i);
@@ -1019,7 +1019,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
        {
          int incr;
          GET_CCL_INT (incr, ccl_prog,
-                      ic + ((unsigned int) reg[rrr] < field1
+                      ic + (0 <= reg[rrr] && reg[rrr] < field1
                             ? reg[rrr]
                             : field1));
          ic += incr;
@@ -1114,7 +1114,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size
 
        case CCL_WriteArray:    /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */
          i = reg[rrr];
-         if ((unsigned int) i < field1)
+         if (0 <= i && i < field1)
            {
              GET_CCL_INT (j, ccl_prog, ic + i);
              CCL_WRITE_CHAR (j);