summaryrefslogtreecommitdiff
path: root/libguile/eq.c
diff options
context:
space:
mode:
authorMark H Weaver <mhw@netris.org>2011-02-10 19:38:49 -0500
committerAndy Wingo <wingo@pobox.com>2011-02-14 20:32:01 +0100
commitf135fc3eda9a34f9540486da433867b2698fa58c (patch)
treec10f3c3264efebc0c68464874ad428a929603297 /libguile/eq.c
parenta8da6d9338e2236742e95a0f7337796078f9e2a3 (diff)
downloadguile-f135fc3eda9a34f9540486da433867b2698fa58c.tar.gz
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.
Diffstat (limited to 'libguile/eq.c')
-rw-r--r--libguile/eq.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libguile/eq.c b/libguile/eq.c
index 99b3488ad..11dce99a1 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