void removeCuckooMap(CuckooMap* map, uint64_t key) { if(key == getKey1(map, key)) { clear1(map, key); } if(key == getKey2(map, key)) { clear2(map, key); } if(findCuckooOptimized(map, key) != CUCKOO_NOT_FOUND) { //assuming that the key was originally in this map, there's an error puts("Error with Removing"); exit(1); } }
// reverse polish calculator int main(void) { int type; double op2; char s[MAXOP]; while ((type = getop(s)) != EOF) { switch(type) { case NUMBER: push(atof(s)); break; case FUNCTION: handleFunction(s); break; case '+': push(pop() + pop()); break; case '-': op2 = pop(); push(pop() - op2); break; case '*': push(pop() * pop()); break; case '/': op2 = pop(); if (op2 != 0.0) { push(pop() / op2); } else { printf("error: division by zero\n"); } break; case '%': op2 = pop(); if (op2 != 0.0) { push((int)pop() % (int)op2); } else { printf("error: modulo by zero\n"); } break; case PEEK: // peek top value of the stack printf("\t%.8g peek value\n", peek()); break; case DUPL: // duplicate the top value of the stack duplicateTop(); break; case SWAP: swap(); break; case CLEAR: clear1(); break; case '\n': printf("\t%.8g\n", pop()); break; default: printf("error: unknown command %s\n", s); break; } } return 0; }