diff src/share/vm/adlc/dict2.cpp @ 10389:f15fe46d8c00

8015266: fix some -Wsign-compare warnings in adlc Reviewed-by: kvn
author twisti
date Thu, 30 May 2013 08:37:08 -0700
parents d336b3173277
children de6a9e811145
line wrap: on
line diff
--- a/src/share/vm/adlc/dict2.cpp	Thu May 30 11:21:01 2013 +0200
+++ b/src/share/vm/adlc/dict2.cpp	Thu May 30 08:37:08 2013 -0700
@@ -64,18 +64,18 @@
   int i;
 
   // Precompute table of null character hashes
-  if( !initflag ) {             // Not initializated yet?
-    xsum[0] = (1<<shft[0])+1;   // Initialize
+  if (!initflag) {              // Not initializated yet?
+    xsum[0] = (short) ((1 << shft[0]) + 1);  // Initialize
     for( i = 1; i < MAXID; i++) {
-      xsum[i] = (1<<shft[i])+1+xsum[i-1];
+      xsum[i] = (short) ((1 << shft[i]) + 1 + xsum[i-1]);
     }
     initflag = 1;               // Never again
   }
 
   _size = 16;                   // Size is a power of 2
   _cnt = 0;                     // Dictionary is empty
-  _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
-  memset(_bin,0,sizeof(bucket)*_size);
+  _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket) * _size);
+  memset(_bin, 0, sizeof(bucket) * _size);
 }
 
 //------------------------------~Dict------------------------------------------
@@ -287,11 +287,11 @@
   register int sum = 0;
   register const char *s = (const char *)t;
 
-  while( ((c = s[k]) != '\0') && (k < MAXID-1) ) { // Get characters till nul
-    c = (c<<1)+1;               // Characters are always odd!
-    sum += c + (c<<shft[k++]);  // Universal hash function
+  while (((c = s[k]) != '\0') && (k < MAXID-1)) { // Get characters till nul
+    c = (char) ((c << 1) + 1);    // Characters are always odd!
+    sum += c + (c << shft[k++]);  // Universal hash function
   }
-  assert( k < (MAXID), "Exceeded maximum name length");
+  assert(k < (MAXID), "Exceeded maximum name length");
   return (int)((sum+xsum[k]) >> 1); // Hash key, un-modulo'd table size
 }