Hi Mark, On Wed 26 Jan 2011 17:32, Mark H Weaver <m...@netris.org> writes:
I don't understand this change: > From c42d03050ea0f96556e73e405e530b78bb85aba7 Mon Sep 17 00:00:00 2001 > From: Mark H Weaver <m...@netris.org> > Date: Wed, 26 Jan 2011 02:56:20 -0500 > Subject: [PATCH] Add case for fractions with differing SCM_CELL_TYPE to > scm_equal_p > > * libguile/eq.c (scm_equal_p): Add a special case for fractions with > differing SCM_CELL_TYPE, which might nonetheless be considered equal > (due to the use of 0x10000 as a flag), to scm_equal_p. This code > was already present in scm_eqv_p. > > (scm_eqv_p): Move comment (regarding special case for fractions) > next to the corresponding code. > --- > libguile/eq.c | 19 +++++++++++++------ > 1 files changed, 13 insertions(+), 6 deletions(-) > > diff --git a/libguile/eq.c b/libguile/eq.c > index 7502559..dc548b8 100644 > @@ -322,6 +322,13 @@ scm_equal_p (SCM x, SCM y) > && SCM_COMPLEX_IMAG (x) == 0.0); > } > > + /* fractions use 0x10000 as a flag (at the suggestion of Marius > Vollmer), > + but this checks the entire type word, so fractions may be accidentally > + flagged here as unequal. Perhaps I should use the 4th double_cell > word? > + */ > + if (SCM_FRACTIONP (x) && SCM_FRACTIONP (y)) > + return scm_i_fraction_equalp (x, y); > + > /* Vectors can be equal to one-dimensional arrays. > */ > if (scm_is_array (x) && scm_is_array (y)) In what case would two fractions ever not have the same SCM_CELL_TYPE ? I don't understand this discussion of flags. AFAICS fractions have their own tc16, and no flags are ever set. Furthermore I would think that the `if (SCM_NUMP (x))' block in scm_eqv_p could use a switch statement instead of a bunch of ifs. Regards, Andy -- http://wingolog.org/