Skip to content

Commit 99eb0c1

Browse files
committed
change infinity macros (Bound)
1 parent 06ce38b commit 99eb0c1

File tree

1 file changed

+9
-15
lines changed

1 file changed

+9
-15
lines changed

src/relation_info.h

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,18 @@
2323
/* Range bound */
2424
typedef struct
2525
{
26-
Datum value; /* Actual value if not infinite */
27-
uint8 is_infinite; /* bitmask where the least significant bit
28-
is indicates if the bound is infinite and
29-
the second one indicates if bound
30-
is negative */
26+
Datum value; /* actual value if not infinite */
27+
int8 is_infinite; /* -inf | +inf | finite */
3128
} Bound;
3229

3330

34-
#define BOUND_INFINITY_MASK 0x01
35-
#define BOUND_NEGATIVE_MASK 0x02
31+
#define FINITE ( 0 )
32+
#define PLUS_INFINITY ( +1 )
33+
#define MINUS_INFINITY ( -1 )
3634

37-
#define FINITE 0
38-
#define PLUS_INFINITY (BOUND_INFINITY_MASK)
39-
#define MINUS_INFINITY (BOUND_INFINITY_MASK | BOUND_NEGATIVE_MASK)
40-
41-
#define IsInfinite(i) ((i)->is_infinite & BOUND_INFINITY_MASK)
42-
#define IsPlusInfinity(i) (IsInfinite(i) && !((i)->is_infinite & BOUND_NEGATIVE_MASK))
43-
#define IsMinusInfinity(i) (IsInfinite(i) && ((i)->is_infinite & BOUND_NEGATIVE_MASK))
35+
#define IsInfinite(i) ( (i)->is_infinite != FINITE )
36+
#define IsPlusInfinity(i) ( (i)->is_infinite == PLUS_INFINITY )
37+
#define IsMinusInfinity(i) ( (i)->is_infinite == MINUS_INFINITY )
4438

4539

4640
inline static Bound
@@ -65,7 +59,7 @@ MakeBound(Datum value)
6559
}
6660

6761
inline static Bound
68-
MakeBoundInf(uint8 infinity_type)
62+
MakeBoundInf(int8 infinity_type)
6963
{
7064
Bound bound = { (Datum) 0, infinity_type };
7165

0 commit comments

Comments
 (0)