summaryrefslogtreecommitdiff
path: root/contrib/cube/cube.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cube/cube.c')
-rw-r--r--contrib/cube/cube.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/contrib/cube/cube.c b/contrib/cube/cube.c
index b98118e367b..6f810b26c5d 100644
--- a/contrib/cube/cube.c
+++ b/contrib/cube/cube.c
@@ -717,14 +717,10 @@ cube_union_v0(NDBOX *a, NDBOX *b)
/* First compute the union of the dimensions present in both args */
for (i = 0; i < DIM(b); i++)
{
- result->x[i] = Min(
- Min(LL_COORD(a, i), UR_COORD(a, i)),
- Min(LL_COORD(b, i), UR_COORD(b, i))
- );
- result->x[i + DIM(a)] = Max(
- Max(LL_COORD(a, i), UR_COORD(a, i)),
- Max(LL_COORD(b, i), UR_COORD(b, i))
- );
+ result->x[i] = Min(Min(LL_COORD(a, i), UR_COORD(a, i)),
+ Min(LL_COORD(b, i), UR_COORD(b, i)));
+ result->x[i + DIM(a)] = Max(Max(LL_COORD(a, i), UR_COORD(a, i)),
+ Max(LL_COORD(b, i), UR_COORD(b, i)));
}
/* continue on the higher dimensions only present in 'a' */
for (; i < DIM(a); i++)
@@ -796,14 +792,10 @@ cube_inter(PG_FUNCTION_ARGS)
/* First compute intersection of the dimensions present in both args */
for (i = 0; i < DIM(b); i++)
{
- result->x[i] = Max(
- Min(LL_COORD(a, i), UR_COORD(a, i)),
- Min(LL_COORD(b, i), UR_COORD(b, i))
- );
- result->x[i + DIM(a)] = Min(
- Max(LL_COORD(a, i), UR_COORD(a, i)),
- Max(LL_COORD(b, i), UR_COORD(b, i))
- );
+ result->x[i] = Max(Min(LL_COORD(a, i), UR_COORD(a, i)),
+ Min(LL_COORD(b, i), UR_COORD(b, i)));
+ result->x[i + DIM(a)] = Min(Max(LL_COORD(a, i), UR_COORD(a, i)),
+ Max(LL_COORD(b, i), UR_COORD(b, i)));
}
/* continue on the higher dimensions only present in 'a' */
for (; i < DIM(a); i++)