add fixnum

This commit is contained in:
Yuichi Nishiwaki
2013-10-12 00:15:46 +09:00
parent 6b0c1aa668
commit 03fbd0bdb6
4 changed files with 21 additions and 3 deletions
+6
View File
@@ -3,6 +3,7 @@
enum pic_vtype {
PIC_VTYPE_NIL,
PIC_VTYPE_INT,
PIC_VTYPE_HEAP
};
@@ -10,12 +11,14 @@ typedef struct {
enum pic_vtype type;
union {
void *data;
int i;
} u;
} pic_value;
enum pic_tt {
/* immediate */
PIC_TT_NIL,
PIC_TT_INT,
/* heap */
PIC_TT_PAIR,
PIC_TT_SYMBOL
@@ -46,6 +49,9 @@ enum pic_tt pic_type(pic_value);
pic_value pic_nil_value();
pic_value pic_obj_value(void *);
pic_value pic_int_value(int);
#define pic_int(v) ((v).u.i)
#define pic_nil_p(v) (pic_type(v) == PIC_TT_NIL)