summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2011-09-24 09:41:54 -0700
committerKaz Kylheku <kaz@kylheku.com>2011-09-24 09:41:54 -0700
commit658eb97af000aa0598e3544c2c7ea2cdd60b5b06 (patch)
tree81fe02dc5086c6e7f7ab6740ea5b035f19a992a1 /lib.h
parent8805225d527a576a072879a9dc21ba9a445c2f1a (diff)
downloadtxr-658eb97af000aa0598e3544c2c7ea2cdd60b5b06.tar.gz
txr-658eb97af000aa0598e3544c2c7ea2cdd60b5b06.tar.bz2
txr-658eb97af000aa0598e3544c2c7ea2cdd60b5b06.zip
Numeric constants become real constants.
Vector code cleanup. * lib.h (zero, one, two, negone, maxint, minint): Extern declarations removed, macros introduced for these identifiers. * lib.c (zero, one, two, negone, maxint, minint): File scope definitions removed. (vector): Use vec_alloc and vec_fill enums instead of constants. (obj_init): Remove references to removed definitions.
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib.h b/lib.h
index bc1e9b83..7b69cbbf 100644
--- a/lib.h
+++ b/lib.h
@@ -222,7 +222,6 @@ extern val query_error_s, file_error_s, process_error_s;
extern val nothrow_k, args_k;
-extern val zero, one, two, negone, maxint, minint;
extern val null_string;
extern val null_list; /* (nil) */
@@ -428,3 +427,11 @@ val match(val spec, val data);
obj_t *c_o_n_s ## CAR ## CDR = CONS; \
obj_t *CAR = car(c_o_n_s ## CAR ## CDR); \
obj_t *CDR = cdr(c_o_n_s ## CAR ## CDR)
+
+#define num_fast(n) ((val) ((n << TAG_SHIFT) | TAG_NUM))
+#define zero num_fast(0)
+#define one num_fast(1)
+#define two num_fast(2)
+#define negone num_fast(-1)
+#define maxint num_fast(NUM_MAX)
+#define minint num_fast(NUM_MIN)