mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 08:17:35 +02:00
Faster version of (boolean?)
This commit is contained in:
parent
0d53f329e9
commit
6bec04f9c4
2 changed files with 11 additions and 10 deletions
|
@ -439,7 +439,8 @@ object Cyc_eq(object x, object y);
|
||||||
int equal(object, object);
|
int equal(object, object);
|
||||||
object equalp(object, object);
|
object equalp(object, object);
|
||||||
object Cyc_has_cycle(object lst);
|
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_pair(o) ((is_object_type(o) && ((list) o)->tag == pair_tag) ? boolean_t : boolean_f)
|
||||||
#define Cyc_is_null(o) (make_boolean(o == NULL))
|
#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:
|
//TODO: convert all of these to macros (if it makes sense, most should), and remove them from runtime.c:
|
||||||
|
|
18
runtime.c
18
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_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);
|
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)
|
//object Cyc_is_boolean(object o)
|
||||||
{
|
//{
|
||||||
if ((o != NULL) &&
|
// if ((o != NULL) &&
|
||||||
!is_value_type(o) &&
|
// !is_value_type(o) &&
|
||||||
((list) o)->tag == boolean_tag && ((boolean_f == o) || (boolean_t == o)))
|
// ((list) o)->tag == boolean_tag && ((boolean_f == o) || (boolean_t == o)))
|
||||||
return boolean_t;
|
// return boolean_t;
|
||||||
return boolean_f;
|
// return boolean_f;
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
//object Cyc_is_pair(object o)
|
//object Cyc_is_pair(object o)
|
||||||
//{
|
//{
|
||||||
// if (is_object_type(o) && ((list) o)->tag == pair_tag)
|
// if (is_object_type(o) && ((list) o)->tag == pair_tag)
|
||||||
|
|
Loading…
Add table
Reference in a new issue