comparison 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
comparison
equal deleted inserted replaced
10388:320b4e0f0892 10389:f15fe46d8c00
62 62
63 void Dict::init() { 63 void Dict::init() {
64 int i; 64 int i;
65 65
66 // Precompute table of null character hashes 66 // Precompute table of null character hashes
67 if( !initflag ) { // Not initializated yet? 67 if (!initflag) { // Not initializated yet?
68 xsum[0] = (1<<shft[0])+1; // Initialize 68 xsum[0] = (short) ((1 << shft[0]) + 1); // Initialize
69 for( i = 1; i < MAXID; i++) { 69 for( i = 1; i < MAXID; i++) {
70 xsum[i] = (1<<shft[i])+1+xsum[i-1]; 70 xsum[i] = (short) ((1 << shft[i]) + 1 + xsum[i-1]);
71 } 71 }
72 initflag = 1; // Never again 72 initflag = 1; // Never again
73 } 73 }
74 74
75 _size = 16; // Size is a power of 2 75 _size = 16; // Size is a power of 2
76 _cnt = 0; // Dictionary is empty 76 _cnt = 0; // Dictionary is empty
77 _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size); 77 _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket) * _size);
78 memset(_bin,0,sizeof(bucket)*_size); 78 memset(_bin, 0, sizeof(bucket) * _size);
79 } 79 }
80 80
81 //------------------------------~Dict------------------------------------------ 81 //------------------------------~Dict------------------------------------------
82 // Delete an existing dictionary. 82 // Delete an existing dictionary.
83 Dict::~Dict() { 83 Dict::~Dict() {
285 int hashstr(const void *t) { 285 int hashstr(const void *t) {
286 register char c, k = 0; 286 register char c, k = 0;
287 register int sum = 0; 287 register int sum = 0;
288 register const char *s = (const char *)t; 288 register const char *s = (const char *)t;
289 289
290 while( ((c = s[k]) != '\0') && (k < MAXID-1) ) { // Get characters till nul 290 while (((c = s[k]) != '\0') && (k < MAXID-1)) { // Get characters till nul
291 c = (c<<1)+1; // Characters are always odd! 291 c = (char) ((c << 1) + 1); // Characters are always odd!
292 sum += c + (c<<shft[k++]); // Universal hash function 292 sum += c + (c << shft[k++]); // Universal hash function
293 } 293 }
294 assert( k < (MAXID), "Exceeded maximum name length"); 294 assert(k < (MAXID), "Exceeded maximum name length");
295 return (int)((sum+xsum[k]) >> 1); // Hash key, un-modulo'd table size 295 return (int)((sum+xsum[k]) >> 1); // Hash key, un-modulo'd table size
296 } 296 }
297 297
298 //------------------------------hashptr-------------------------------------- 298 //------------------------------hashptr--------------------------------------
299 // Slimey cheap hash function; no guaranteed performance. Better than the 299 // Slimey cheap hash function; no guaranteed performance. Better than the