Date: Fri, 21 Mar 2014 19:10:52 +0100 From: Yves Bastide <ybastide@...il.com> To: musl <musl@...ts.openwall.com> Subject: Re: src/string/strstr.c, src/string/wcsstr.c: wrong estimates for MIN(l,63)? 2014-03-21 18:44 GMT+01:00 Rich Felker <dalias@...ifal.cx>: > On Fri, Mar 21, 2014 at 06:07:45PM +0100, Szabolcs Nagy wrote: >> * Rich Felker <dalias@...ifal.cx> [2014-03-21 12:48:17 -0400]: >> > On Fri, Mar 21, 2014 at 03:07:22PM +0100, Yves Bastide wrote: >> > > /* Fast estimate for MIN(l,63) */ >> > > size_t grow = l | 63; >> > > >> > > "grow" is thus always at least 63... >> > >> > If you look at how grow is used on the very next line, this should >> > make sense. >> >> the comment is wrong though >> z grows by at least max(63,l) unless end-of-string is reached > > Yes, (l|63) is >= both l and 63, so it should read MAX, not MIN. The > idea is that it's useless to grow by less than l, but it's inefficient > to grow by less than some fixed threshold even if the needle is tiny. > > Rich OK, understood. Thanks! yves
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.