March 9, 2006
9:34 p.m.
Ken Pizzini <tz.@explicate.org> writes:
On Wed, Mar 08, 2006 at 11:15:02PM -0800, Paul Eggert wrote:
! int lo = 1; [snip] ! if (lo <= i && i < hi) { ! if (t < sp->ats[i]) { ! if (sp->ats[i - 1] <= t) ! goto found; ! i--; ! if (sp->ats[i - 1] <= t) ! goto found; [snip] ! found: ! guess = i; i = (int) sp->types[i - 1];
If i == lo (== 1), and the first <=t test fails
That can't happen, due to a previous test of t against sp->ats[0] (in earlier code) which will will cause all the quoted code to be bypassed. So I don't see any bug there.
it's quite a bit of complexity for not much benefit, and think I'd prefer the simple binary search.
Me too.