1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

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.
This commit is contained in:
Mark H Weaver 2011-02-10 19:38:49 -05:00 committed by Andy Wingo
parent a8da6d9338
commit f135fc3eda

View file

@ -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