38 #include "utils/fmgrprotos.h"
173 bool differentFamilies =
false;
186 differentFamilies =
true;
202 if (differentFamilies)
252 which = 1 | (1 << 1);
308 if (which & (1 <<
i))
355 ip_addr(
val)[commonbits / 8] & (1 << (7 - commonbits % 8)))
385 bitmap = 1 | (1 << 1) | (1 << 2) | (1 << 3);
389 for (
i = 0;
i < nkeys;
i++)
448 if (commonbits <=
ip_bits(argument))
449 bitmap &= (1 << 2) | (1 << 3);
453 if (commonbits <
ip_bits(argument))
454 bitmap &= (1 << 2) | (1 << 3);
458 if (commonbits ==
ip_bits(argument) - 1)
459 bitmap &= 1 | (1 << 1);
460 else if (commonbits >=
ip_bits(argument))
465 if (commonbits ==
ip_bits(argument))
466 bitmap &= 1 | (1 << 1);
467 else if (commonbits >
ip_bits(argument))
472 if (commonbits <
ip_bits(argument))
473 bitmap &= (1 << 2) | (1 << 3);
474 else if (commonbits ==
ip_bits(argument))
475 bitmap &= 1 | (1 << 1);
538 if (bitmap & ((1 << 2) | (1 << 3)) &&
539 commonbits <
ip_bits(argument))
543 nextbit =
ip_addr(argument)[commonbits / 8] &
544 (1 << (7 - commonbits % 8));
551 bitmap &= 1 | (1 << 1) | (1 << 2);
557 bitmap &= 1 | (1 << 1) | (1 << 3);
565 bitmap &= 1 | (1 << 1) | (1 << 2);
567 bitmap &= 1 | (1 << 1) | (1 << 3);
594 if (commonbits ==
ip_bits(argument))
595 bitmap &= 1 | (1 << 1);
596 else if (commonbits >
ip_bits(argument))
602 if (commonbits <
ip_bits(argument))
603 bitmap &= (1 << 2) | (1 << 3);
611 if (commonbits !=
ip_bits(argument))
624 if (!leaf && bitmap & (1 | (1 << 1)) &&
629 nextbit =
ip_addr(argument)[commonbits / 8] &
630 (1 << (7 - commonbits % 8));
637 bitmap &= 1 | (1 << 2) | (1 << 3);
643 bitmap &= (1 << 1) | (1 << 2) | (1 << 3);
651 bitmap &= 1 | (1 << 2) | (1 << 3);
653 bitmap &= (1 << 1) | (1 << 2) | (1 << 3);
#define Assert(condition)
#define PG_GETARG_POINTER(n)
#define PG_RETURN_BOOL(x)
int bitncommon(const unsigned char *l, const unsigned char *r, int n)
int bitncmp(const unsigned char *l, const unsigned char *r, int n)
inet * cidr_set_masklen_internal(const inet *src, int bits)
Datum inet_spg_config(PG_FUNCTION_ARGS)
Datum inet_spg_choose(PG_FUNCTION_ARGS)
Datum inet_spg_leaf_consistent(PG_FUNCTION_ARGS)
Datum inet_spg_inner_consistent(PG_FUNCTION_ARGS)
static int inet_spg_node_number(const inet *val, int commonbits)
static int inet_spg_consistent_bitmap(const inet *prefix, int nkeys, ScanKey scankeys, bool leaf)
Datum inet_spg_picksplit(PG_FUNCTION_ARGS)
#define RTNotEqualStrategyNumber
#define RTSubStrategyNumber
#define RTSubEqualStrategyNumber
#define RTSuperEqualStrategyNumber
#define RTEqualStrategyNumber
#define RTLessEqualStrategyNumber
#define RTGreaterEqualStrategyNumber
#define RTGreaterStrategyNumber
#define RTSuperStrategyNumber
#define RTLessStrategyNumber
StrategyNumber sk_strategy
struct spgChooseOut::@50::@53 splitTuple
spgChooseResultType resultType
union spgChooseOut::@50 result
struct spgChooseOut::@50::@51 matchNode
static Datum InetPGetDatum(const inet *X)
#define ip_family(inetptr)
static inet * DatumGetInetPP(Datum X)
#define ip_maxbits(inetptr)