Hi, I tried working with your library to build my own custom version and I think have found a small bug.
in a rare cases where there is a collision in hash function. for instance A and B.
then following code may result having duplicated items in the array.
tgc_add(gc, A, size, flags, dtor);
tgc_add(gc, B, size, flags, dtor);
tgc_add(gc, A, size, flags, dtor);
tgc_add(gc, B, size, flags, dtor);
// after sweep phase, dtor is called 4 times instead of 2.
I know it is never intended to accept such inputs. I needed this functionality.
I'm not sure about functionality of tgc_probe, but in this case changing this line
to
solves this problem and saves performance by not moving items with same hash value.
Hi, I tried working with your library to build my own custom version and I think have found a small bug.
in a rare cases where there is a collision in hash function. for instance A and B.
then following code may result having duplicated items in the array.
I know it is never intended to accept such inputs. I needed this functionality.
I'm not sure about functionality of
tgc_probe, but in this case changing this linetgc/tgc.c
Line 46 in 81ce102
to
solves this problem and saves performance by not moving items with same hash value.