Пример #1
0
static int
hemdist(bytea *a, bytea *b) {
  if (ISALLTRUE(a)) {
    if (ISALLTRUE(b))
      return 0;
    else
      return SIGLENBIT(b) - bitstringWeight(SIGLEN(b), (uint8 *)VARDATA(b));
  }
  else if (ISALLTRUE(b)) {
    return SIGLENBIT(a) - bitstringWeight(SIGLEN(a), (uint8 *)VARDATA(a));
  }
  return hemdistsign(a, b);
}
Пример #2
0
static int
hemdist(bytea *a, bytea *b)
{
  if (ISALLTRUE(a))
    {
      if (ISALLTRUE(b))
        return 0;
      else
        return SIGLENBIT(b) - sizebitvec(b);
    }
  else if (ISALLTRUE(b))
    return SIGLENBIT(a) - sizebitvec(a);

  return hemdistsign(a, b);
}