@@ -138,7 +138,7 @@ hash_lookup(ht, key, hash)
138138 hash_T perturb ;
139139 hashitem_T * freeitem ;
140140 hashitem_T * hi ;
141- int idx ;
141+ unsigned idx ;
142142
143143#ifdef HT_DEBUG
144144 ++ hash_count_lookup ;
@@ -150,7 +150,7 @@ hash_lookup(ht, key, hash)
150150 * - skip over a removed item
151151 * - return if the item matches
152152 */
153- idx = (int )(hash & ht -> ht_mask );
153+ idx = (unsigned )(hash & ht -> ht_mask );
154154 hi = & ht -> ht_array [idx ];
155155
156156 if (hi -> hi_key == NULL )
@@ -176,7 +176,7 @@ hash_lookup(ht, key, hash)
176176#ifdef HT_DEBUG
177177 ++ hash_count_perturb ; /* count a "miss" for hashtab lookup */
178178#endif
179- idx = (int )((idx << 2 ) + idx + perturb + 1 );
179+ idx = (unsigned )((idx << 2U ) + idx + perturb + 1U );
180180 hi = & ht -> ht_array [idx & ht -> ht_mask ];
181181 if (hi -> hi_key == NULL )
182182 return freeitem == NULL ? hi : freeitem ;
@@ -342,7 +342,7 @@ hash_may_resize(ht, minitems)
342342 hashitem_T temparray [HT_INIT_SIZE ];
343343 hashitem_T * oldarray , * newarray ;
344344 hashitem_T * olditem , * newitem ;
345- int newi ;
345+ unsigned newi ;
346346 int todo ;
347347 long_u oldsize , newsize ;
348348 long_u minsize ;
@@ -448,13 +448,13 @@ hash_may_resize(ht, minitems)
448448 * the algorithm to find an item in hash_lookup(). But we only
449449 * need to search for a NULL key, thus it's simpler.
450450 */
451- newi = (int )(olditem -> hi_hash & newmask );
451+ newi = (unsigned )(olditem -> hi_hash & newmask );
452452 newitem = & newarray [newi ];
453453
454454 if (newitem -> hi_key != NULL )
455455 for (perturb = olditem -> hi_hash ; ; perturb >>= PERTURB_SHIFT )
456456 {
457- newi = (int )((newi << 2 ) + newi + perturb + 1 );
457+ newi = (unsigned )((newi << 2U ) + newi + perturb + 1U );
458458 newitem = & newarray [newi & newmask ];
459459 if (newitem -> hi_key == NULL )
460460 break ;
0 commit comments