public override int Compare(int slot1, int slot2)
{
// TODO: there are sneaky non-branch ways to compute
// -1/+1/0 sign
// Cannot return values[slot1] - values[slot2] because that
// may overflow
int v1 = values[slot1];
int v2 = values[slot2];
if (v1 > v2)
{
return 1;
}
else if (v1 < v2)
{
return - 1;
}
else
{
return 0;
}
}