bool addRecursive(CuckooMap* map, uint64_t key, uint64_t value, int depth) { if(depth > MAX_LOOP) { return false; } //if its empty in the first table, add it there if(getKey1(map, key) == NONE) { set1(map, key, value); } //if its empty in the second table, add it there else if(getKey2(map, key) == NONE) { set2(map, key, value); } //if both are occupied, randomly displace one and re-add the displaced one else if((xorshf96() & 1) == 0) { uint64_t pushedKey = getKey1(map, key); uint64_t pushedValue = getValue1(map, key); set1(map, key, value); return addRecursive(map, pushedKey, pushedValue, depth + 1); } else { uint64_t pushedKey = getKey2(map, key); uint64_t pushedValue = getValue2(map, key); set2(map, key, value); return addRecursive(map, pushedKey, pushedValue, depth + 1); } return true; }
void Object_Menu_Control::do_set_drive_type(void) { emit sig_drive_type(getValue1()); }