>From 97b4468e7759aed6f9d289f03e517ff362127c31 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 10 Feb 2011 19:38:49 -0500 Subject: [PATCH 7/9] Slight optimization for scm_equal_p * libguile/eq.c (scm_equal_p): Move SCM_STRUCTP check within the default case of the SCM_TYP7 switch statement, for optimization. --- libguile/eq.c | 16 ++++++++-------- 1 files changed, 8 insertions(+), 8 deletions(-) diff --git a/libguile/eq.c b/libguile/eq.c index 99b3488..11dce99 100644 --- a/libguile/eq.c +++ b/libguile/eq.c @@ -332,6 +332,14 @@ scm_equal_p (SCM x, SCM y) switch (SCM_TYP7 (x)) { default: + /* Check equality between structs of equal type (see cell-type test above). */ + if (SCM_STRUCTP (x)) + { + if (SCM_INSTANCEP (x)) + goto generic_equal; + else + return scm_i_struct_equalp (x, y); + } break; case scm_tc7_number: switch SCM_TYP16 (x) @@ -349,14 +357,6 @@ scm_equal_p (SCM x, SCM y) case scm_tc7_wvect: return scm_i_vector_equal_p (x, y); } - /* Check equality between structs of equal type (see cell-type test above). */ - if (SCM_STRUCTP (x)) - { - if (SCM_INSTANCEP (x)) - goto generic_equal; - else - return scm_i_struct_equalp (x, y); - } /* Otherwise just return false. Dispatching to the generic is the wrong thing here, as we can hit this case for any two objects of the same type that we -- 1.7.1