Add an 'undefined' value and a function to convert booleans into values.

This commit is contained in:
Jesse D. McDonald 2009-11-11 00:24:07 -06:00
parent 0005ef2f86
commit 56a67a263d
1 changed files with 6 additions and 0 deletions

6
gc.h
View File

@ -32,6 +32,7 @@ typedef intptr_t fixnum_t;
#define BROKEN_HEART SPECIAL_VALUE(0)
#define FALSE_VALUE SPECIAL_VALUE(1)
#define TRUE_VALUE SPECIAL_VALUE(2)
#define UNDEFINED SPECIAL_VALUE(3)
#define TYPE_TAG_BOX TYPE_TAG(0)
#define TYPE_TAG_VECTOR TYPE_TAG(1)
@ -180,6 +181,11 @@ static inline bool is_boolean(value_t v)
return (v == FALSE_VALUE) || (v == TRUE_VALUE);
}
static inline value_t make_boolean(bool b)
{
return b ? TRUE_VALUE : FALSE_VALUE;
}
static inline value_t object_value(void *obj)
{
assert((uintptr_t)obj >= 4096);