Lines Matching defs:bucket
53 //------------------------------bucket---------------------------------------
54 class bucket : public ResourceObj {
56 uint _cnt, _max; // Size of bucket
62 // of two, for nice modulo operations. Each bucket in the hash table points
84 _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
85 memset(_bin,0,sizeof(bucket)*_size);
105 _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
106 memset(_bin,0,sizeof(bucket)*_size);
141 _bin = (bucket*)_arena->Arealloc( _bin, sizeof(bucket)*oldsize, sizeof(bucket)*_size );
142 memset( &_bin[oldsize], 0, oldsize*sizeof(bucket) );
145 bucket *b = &_bin[i]; // Handy shortcut for _bin[i]
148 bucket *nb = &_bin[i+oldsize]; // New bucket shortcut
149 uint j = b->_max; // Trim new bucket to nearest power of 2
150 while( j > b->_cnt ) j >>= 1; // above old bucket _cnt
157 for( j=0; j<b->_cnt; j++ ) { // Rehash all keys in this bucket
159 if( (_hash( key ) & (_size-1)) != i ) { // Moving to hi bucket?
163 b->_cnt--; // Remove key/value from lo bucket
168 } // End of for all key-value pairs in bucket
177 _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
178 memcpy( _bin, d._bin, sizeof(bucket)*_size );
191 _bin = (bucket*)_arena->Arealloc( _bin, sizeof(bucket)*_size, sizeof(bucket)*d._size );
192 memset( &_bin[_size], 0, (d._size-_size)*sizeof(bucket) );
197 _bin[i]._cnt = 0; // But leave bucket allocations alone
202 bucket *b = &d._bin[i]; // Shortcut to source bucket
218 bucket *b = &_bin[i]; // Handy shortcut
236 if( b->_cnt == b->_max ) { // Must grow bucket?
238 b->_max = 2; // Initial bucket size
242 b->_max <<= 1; // Double bucket
255 bucket *b = &_bin[i]; // Handy shortcut
259 b->_cnt--; // Remove key/value from lo bucket
273 bucket *b = &_bin[i]; // Handy shortcut
289 bucket *b = &_bin[i]; // Handy shortcut
380 while( ++_i < _d->_size ) { // Else scan for non-zero bucket