Force inlining of Cyc_is_null

By redefining as a macro there is a large potential speed increase with certain programs, with very few changes on our end.
This commit is contained in:
Justin Ethier 2018-06-08 15:06:11 -04:00
parent 9c1ea32be0
commit 44c246c38e
3 changed files with 10 additions and 9 deletions

View file

@ -440,9 +440,8 @@ 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);
//object Cyc_is_pair(object o);
#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)
object Cyc_is_null(object o); #define Cyc_is_null(o) make_boolean(o == NULL)
object Cyc_is_number(object o); object Cyc_is_number(object o);
object Cyc_is_complex(object o); object Cyc_is_complex(object o);
object Cyc_is_real(object o); object Cyc_is_real(object o);

View file

@ -626,6 +626,8 @@ typedef boolean_type *boolean;
#define boolean_desc(x) (((boolean_type *) x)->desc) #define boolean_desc(x) (((boolean_type *) x)->desc)
#define make_boolean(x) (x ? boolean_t : boolean_f)
/** /**
* @brief Symbols are similar to strings, but only one instance of each * @brief Symbols are similar to strings, but only one instance of each
* unique symbol is created, so comparisons are O(1). * unique symbol is created, so comparisons are O(1).

View file

@ -1557,13 +1557,13 @@ object Cyc_is_boolean(object o)
// return boolean_t; // return boolean_t;
// return boolean_f; // return boolean_f;
//} //}
//
object Cyc_is_null(object o) //object Cyc_is_null(object o)
{ //{
if (o == NULL) // if (o == NULL)
return boolean_t; // return boolean_t;
return boolean_f; // return boolean_f;
} //}
object Cyc_is_number(object o) object Cyc_is_number(object o)
{ {