size_t key_index(dict *d, size_t key) { size_t index = 0; size_t slot_index = 0; index += d->checkpoints[key / 1024]; slot_index = (key / 1024) * 16; key %= 1024; while (key >= 64) { index += popcountll(d->slots[slot_index++]); key -= 64; } index += popcountll(((1ULL << key) - 1) & d->slots[slot_index]); return index; }
size_t num_keys(dict *d) { size_t num = 0; for (size_t i = 0; i < d->num_slots; i++) { num += popcountll(d->slots[i]); } return num; }
void finalize_dict(dict *d) { d->checkpoints = malloc(((d->num_slots / 16) + 1) * sizeof(size_t)); // FIXME size_t checkpoint = 0; for (size_t i = 0; i < d->num_slots; i++) { if (i % 16 == 0) { d->checkpoints[i / 16] = checkpoint; } checkpoint += popcountll(d->slots[i]); } }
unsigned picture_pool_Reset(picture_pool_t *pool) { unsigned ret; vlc_mutex_lock(&pool->lock); assert(pool->refs > 0); ret = pool->picture_count - popcountll(pool->available); pool->available = (1ULL << pool->picture_count) - 1; vlc_mutex_unlock(&pool->lock); return ret; }
void computeCardinalities(CUDA_WORD * differences, int * cardIndvSets,int cardDiff, int setSize){ int i,j, offset; #pragma omp parallel private(i,j,offset) if(cardDiff > CHUNKSIZE) num_threads(12) { // fprintf(stderr,"TID %d\n",omp_get_thread_num()); #pragma omp for schedule(dynamic,CHUNKSIZE) nowait for (i=0; i < cardDiff; i++){ offset = i*setSize; cardIndvSets[i]=0; for(j=offset; j < offset+setSize; j++) { cardIndvSets[i]+= popcountll(differences[j]); } } } //parallel OMP }