static ulong hunt(HHSet *S, ulong h, ulong k, int kill) {
  int i = hhashsucc(S->T, h, 0);
  while (i >= 0) {
    ulong x = hhashget(S->T, h, i);
    if (S->cmp(k, x) == 0) {
      if (kill) hhashdel(S->T, h, i);
      return x;
    }
    i = hhashsucc(S->T, h, i + 1);
  }
  return 0;
}
Beispiel #2
0
int
main(void)
{
	uint n = 16;
	HHash *T = hhashnew(n);
	uint x = rand()%n;
	test(hhashput(T,x,1));
	uint i = hhashsucc(T,x,0);
	test(i == 0);
	hhashdel(T,x,i);
	test(hhashsucc(T,x,0) < 0);
	hhashfree(T);
	return 0;
}