File tree Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Expand file tree Collapse file tree 1 file changed +9
-15
lines changed Original file line number Diff line number Diff line change 23
23
/* Range bound */
24
24
typedef struct
25
25
{
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 */
31
28
} Bound ;
32
29
33
30
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 )
36
34
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 )
44
38
45
39
46
40
inline static Bound
@@ -65,7 +59,7 @@ MakeBound(Datum value)
65
59
}
66
60
67
61
inline static Bound
68
- MakeBoundInf (uint8 infinity_type )
62
+ MakeBoundInf (int8 infinity_type )
69
63
{
70
64
Bound bound = { (Datum ) 0 , infinity_type };
71
65
You can’t perform that action at this time.
0 commit comments