From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4087 Path: news.gmane.org!not-for-mail From: Michael Forney Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] mbsrtowcs: Fix bug when wn is a multiple of 4 Date: Fri, 27 Sep 2013 15:43:53 -0700 Message-ID: <52460a2d.e2a1440a.2f4d.6551@mx.google.com> References: <1380272082-13878-1-git-send-email-mforney@mforney.org> <20130927152849.GC20515@brightrain.aerifal.cx> <20130927155618.GD20515@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1380321848 14293 80.91.229.3 (27 Sep 2013 22:44:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 27 Sep 2013 22:44:08 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4091-gllmg-musl=m.gmane.org@lists.openwall.com Sat Sep 28 00:44:12 2013 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 1VPglf-0002A4-Ub for gllmg-musl@plane.gmane.org; Sat, 28 Sep 2013 00:44:12 +0200 Original-Received: (qmail 23890 invoked by uid 550); 27 Sep 2013 22:44:10 -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 23882 invoked from network); 27 Sep 2013 22:44:10 -0000 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:in-reply-to :mime-version:date:message-id:content-type; bh=82qRf8pQhoYpdivuFecJdgvw/dNmmP0WUgnDGlzkvO4=; b=DWkzl8XaZCj7/63MEZjGYZxLJ7kwiIoiBPoTzUOjuM/esFIidbPEFINOW15vcV1HYk 5kVN6E+2rBhalZrR7d2vK3NJn8R5hVtNCD+xLXKE+Y2zIQHgTAQZQRe3tW4Lr/IasWwS EwBrJba67Z2KGUTwEFoFWtiDGwmBhkWtvvOHUeR2wx7UXnqfB3bzzwxQ40AnYqzZeLtC llWdGSYnPnJ2uB3auguDKb2sReWklG85u2QEY8Ry5Ufs+Xj1+8tqzIZ6w5W1zdBauIDK oHo4pkeLpE8EkzL08RyaGYmoWaHJ4aBek1sA/4sV5ys1BEGJmm1UDkYdJuoYGuxIlwQ1 0odQ== X-Gm-Message-State: ALoCoQkOcT/zwxKvBPtXGqRCgN1jMaFvVAla2oGzK1TwSX6eOlh0vFLN61VnFixa8S9VHPzPv0b3 X-Received: by 10.68.197.73 with SMTP id is9mr9888833pbc.75.1380321837953; Fri, 27 Sep 2013 15:43:57 -0700 (PDT) In-Reply-To: <20130927155618.GD20515@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:4087 Archived-At: On Fri, 27 Sep 2013 11:56:18 -0400, Rich Felker wrote: > > Rather than adding an extra branch here, why not just either change > > the >=4 condition to >=5 or unconditionally continue here? Any > > thoughts on what would be better? > > Forget what I said about just continuing; it would lead to an infinite > loop. I think checking for wn>=5 is probably the best solution to > avoid extra branches in a fairly common code path (ASCII at an aligned > position but not 4 ASCII characters in a row). At some point perhaps > all of this code should be reworked (with proper benchmarking to > measure the effect of changes) but for now we just need a fix. > > Rich Yeah, I didn't make any performance considerations, I just figured this would be the easiest/simplest fix. The solution you've committed is fine. Thanks! -- Michael Forney