Lines Matching defs:bucket

39 //------------------------------bucket---------------------------------------
40 class bucket {
42 int _cnt, _max; // Size of bucket
48 // of two, for nice modulo operations. Each bucket in the hash table points
77 _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
78 memset(_bin,0,sizeof(bucket)*_size);
105 _bin = (bucket*)_arena->Arealloc( _bin, sizeof(bucket)*oldsize, sizeof(bucket)*_size );
106 memset( &_bin[oldsize], 0, oldsize*sizeof(bucket) );
109 bucket *b = &_bin[i]; // Handy shortcut for _bin[i]
112 bucket *nb = &_bin[i+oldsize]; // New bucket shortcut
113 int j = b->_max; // Trim new bucket to nearest power of 2
114 while( j > b->_cnt ) j >>= 1; // above old bucket _cnt
121 for( j=0; j<b->_cnt; j++ ) { // Rehash all keys in this bucket
123 if( (_hash( key ) & (_size-1)) != i ) { // Moving to hi bucket?
127 b->_cnt--; // Remove key/value from lo bucket
132 } // End of for all key-value pairs in bucket
141 _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
142 memcpy( _bin, d._bin, sizeof(bucket)*_size );
155 _bin = (bucket*)_arena->Arealloc( _bin, sizeof(bucket)*_size, sizeof(bucket)*d._size );
156 memset( &_bin[_size], 0, (d._size-_size)*sizeof(bucket) );
160 _bin[i]._cnt = 0; // But leave bucket allocations alone
165 bucket *b = &d._bin[k]; // Shortcut to source bucket
181 bucket *b = &_bin[i]; // Handy shortcut
195 if( b->_cnt == b->_max ) { // Must grow bucket?
197 b->_max = 2; // Initial bucket size
201 b->_max <<= 1; // Double bucket
214 bucket *b = &_bin[i]; // Handy shortcut
218 b->_cnt--; // Remove key/value from lo bucket
232 bucket *b = &_bin[i]; // Handy shortcut
248 bucket *b = &_bin[i]; // Handy shortcut
264 bucket *b = &_bin[i]; // Handy shortcut
347 while( ++_i < _d->_size ) { // Else scan for non-zero bucket