From 6bec04f9c4c104d5d2e97d53ad5c1adf80eb585a Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 8 Jun 2018 17:53:46 -0400 Subject: [PATCH] Faster version of (boolean?) --- include/cyclone/runtime.h | 3 ++- runtime.c | 18 +++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/cyclone/runtime.h b/include/cyclone/runtime.h index 1d13bb92..33ea1b79 100644 --- a/include/cyclone/runtime.h +++ b/include/cyclone/runtime.h @@ -439,7 +439,8 @@ object Cyc_eq(object x, object y); int equal(object, object); object equalp(object, object); object Cyc_has_cycle(object lst); -object Cyc_is_boolean(object o); +//object Cyc_is_boolean(object o); +#define Cyc_is_boolean(o) (make_boolean(o == boolean_f || o == boolean_t)) #define Cyc_is_pair(o) ((is_object_type(o) && ((list) o)->tag == pair_tag) ? boolean_t : boolean_f) #define Cyc_is_null(o) (make_boolean(o == NULL)) //TODO: convert all of these to macros (if it makes sense, most should), and remove them from runtime.c: diff --git a/runtime.c b/runtime.c index aa9b6750..f50bce19 100644 --- a/runtime.c +++ b/runtime.c @@ -1542,15 +1542,15 @@ declare_num_cmp(Cyc_num_lt, Cyc_num_lt_op, Cyc_num_fast_lt_op, dispatch_num_lt declare_num_cmp(Cyc_num_gte, Cyc_num_gte_op, Cyc_num_fast_gte_op, dispatch_num_gte, >=, CYC_BN_GTE); declare_num_cmp(Cyc_num_lte, Cyc_num_lte_op, Cyc_num_fast_lte_op, dispatch_num_lte, <=, CYC_BN_LTE); -object Cyc_is_boolean(object o) -{ - if ((o != NULL) && - !is_value_type(o) && - ((list) o)->tag == boolean_tag && ((boolean_f == o) || (boolean_t == o))) - return boolean_t; - return boolean_f; -} - +//object Cyc_is_boolean(object o) +//{ +// if ((o != NULL) && +// !is_value_type(o) && +// ((list) o)->tag == boolean_tag && ((boolean_f == o) || (boolean_t == o))) +// return boolean_t; +// return boolean_f; +//} +// //object Cyc_is_pair(object o) //{ // if (is_object_type(o) && ((list) o)->tag == pair_tag)