From 56a67a263d32de6ccc9afb6bd7daa50e4a1e5aee Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Wed, 11 Nov 2009 00:24:07 -0600 Subject: [PATCH] Add an 'undefined' value and a function to convert booleans into values. --- gc.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gc.h b/gc.h index 111546e..acaa6e8 100644 --- a/gc.h +++ b/gc.h @@ -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);