MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / createSet

Function createSet

src/intset.c:362–376  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

360}
361
362static intset *createSet(int bits, int size) {
363 uint64_t mask = (1<<bits)-1;
364 uint64_t value;
365 intset *is = intsetNew();
366
367 for (int i = 0; i < size; i++) {
368 if (bits > 32) {
369 value = (rand()*rand()) & mask;
370 } else {
371 value = rand() & mask;
372 }
373 is = intsetAdd(is,value,NULL);
374 }
375 return is;
376}
377
378static void checkConsistency(intset *is) {
379 for (uint32_t i = 0; i < (intrev32ifbe(is->length)-1); i++) {

Callers 1

intsetTestFunction · 0.85

Calls 2

intsetNewFunction · 0.85
intsetAddFunction · 0.85

Tested by

no test coverage detected