[Pcre-svn] [1649] code/trunk: Minor refactor to avoid "left …

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1649] code/trunk: Minor refactor to avoid "left shift of negative value" warning.
Revision: 1649
          http://vcs.pcre.org/viewvc?view=rev&revision=1649
Author:   ph10
Date:     2016-05-21 14:34:44 +0100 (Sat, 21 May 2016)
Log Message:
-----------
Minor refactor to avoid "left shift of negative value" warning.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_internal.h


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-05-20 10:33:36 UTC (rev 1648)
+++ code/trunk/ChangeLog    2016-05-21 13:34:44 UTC (rev 1649)
@@ -82,7 +82,9 @@
 20. A racing condition is fixed in JIT reported by Mozilla.


 21. Minor code refactor to avoid "array subscript is below array bounds" 
-compiler warning.
+    compiler warning.
+    
+22. Minor code refactor to avoid "left shift of negative number" warning. 



Version 8.38 23-November-2015

Modified: code/trunk/pcre_internal.h
===================================================================
--- code/trunk/pcre_internal.h    2016-05-20 10:33:36 UTC (rev 1648)
+++ code/trunk/pcre_internal.h    2016-05-21 13:34:44 UTC (rev 1649)
@@ -275,7 +275,7 @@


typedef pcre_uint16 pcre_uchar;
#define UCHAR_SHIFT (1)
-#define IN_UCHARS(x) ((x) << UCHAR_SHIFT)
+#define IN_UCHARS(x) ((x) * 2)
#define MAX_255(c) ((c) <= 255u)
#define TABLE_GET(c, table, default) (MAX_255(c)? ((table)[c]):(default))

@@ -283,7 +283,7 @@

typedef pcre_uint32 pcre_uchar;
#define UCHAR_SHIFT (2)
-#define IN_UCHARS(x) ((x) << UCHAR_SHIFT)
+#define IN_UCHARS(x) ((x) * 4)
#define MAX_255(c) ((c) <= 255u)
#define TABLE_GET(c, table, default) (MAX_255(c)? ((table)[c]):(default))