From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4699 Path: news.gmane.org!not-for-mail From: Yves Bastide Newsgroups: gmane.linux.lib.musl.general Subject: Re: src/string/strstr.c, src/string/wcsstr.c: wrong estimates for MIN(l,63)? Date: Fri, 21 Mar 2014 19:10:52 +0100 Message-ID: References: <20140321164817.GJ26358@brightrain.aerifal.cx> <20140321170745.GC27448@port70.net> <20140321174406.GK26358@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1395425480 32056 80.91.229.3 (21 Mar 2014 18:11:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 21 Mar 2014 18:11:20 +0000 (UTC) To: musl Original-X-From: musl-return-4703-gllmg-musl=m.gmane.org@lists.openwall.com Fri Mar 21 19:11:30 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WR3uh-00078M-K7 for gllmg-musl@plane.gmane.org; Fri, 21 Mar 2014 19:11:27 +0100 Original-Received: (qmail 1947 invoked by uid 550); 21 Mar 2014 18:11:26 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 1938 invoked from network); 21 Mar 2014 18:11:26 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=jxgUGCkvtD2JGjaNJ7wE2PlRDTfK6BH8AEhE9EDNk9I=; b=ekPepAniyIuXLlrUhZFLBQYh+YfmNHy8nSsOPtXgisHdRIRzHTJtk4m45Wea37TaAa V4T2K25tkC+XvPNQhDZmZHuM5tKVfvM9Qe+NXrvObpiqPLpApE9LIIXv3D/WgxF/igSh jYxo2IE+YORN8fAXB8QhTN0HMAzaT6lVuK7CHLyH0P8AR3u+/crJ/tkVpftnmEoHD2jo 1O8uhDCFJEPEedM20iVAcRk12i2PptMZNxjWcH/B2PhOAP+eo0kaCYAG4MKK+R9VFaLE wE4MSQteHmT8LDMzw42Q+ywi19EBnwK+HjOpwBQcRb6BvjwlFfdQKLkP9QJObmY22tGF nhjw== X-Received: by 10.221.26.10 with SMTP id rk10mr38519741vcb.0.1395425473874; Fri, 21 Mar 2014 11:11:13 -0700 (PDT) In-Reply-To: <20140321174406.GK26358@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:4699 Archived-At: 2014-03-21 18:44 GMT+01:00 Rich Felker : > On Fri, Mar 21, 2014 at 06:07:45PM +0100, Szabolcs Nagy wrote: >> * Rich Felker [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