From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.devel Subject: Re: Optimizing =?utf-8?b?4oCYc3RyaW5nPeKAmQ==?= Date: Tue, 22 Jun 2010 22:43:55 +0200 Message-ID: <87d3viiyr8.fsf@gnu.org> References: <87k4pqj1pc.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1277239448 13325 80.91.229.12 (22 Jun 2010 20:44:08 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 22 Jun 2010 20:44:08 +0000 (UTC) To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Tue Jun 22 22:44:07 2010 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ORAKF-0008TL-62 for guile-devel@m.gmane.org; Tue, 22 Jun 2010 22:44:07 +0200 Original-Received: from localhost ([127.0.0.1]:41001 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORAKE-00034r-HX for guile-devel@m.gmane.org; Tue, 22 Jun 2010 16:44:06 -0400 Original-Received: from [140.186.70.92] (port=52383 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ORAK9-00032h-SV for guile-devel@gnu.org; Tue, 22 Jun 2010 16:44:02 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1ORAK8-0002Jw-KX for guile-devel@gnu.org; Tue, 22 Jun 2010 16:44:01 -0400 Original-Received: from mail4-relais-sop.national.inria.fr ([192.134.164.105]:38724) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1ORAK8-0002JR-9Q for guile-devel@gnu.org; Tue, 22 Jun 2010 16:44:00 -0400 X-IronPort-AV: E=Sophos;i="4.53,462,1272837600"; d="scan'208";a="65124402" Original-Received: from reverse-83.fdn.fr (HELO nixey) ([80.67.176.83]) by mail4-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES128-SHA; 22 Jun 2010 22:43:57 +0200 X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 4 Messidor an 218 de la =?iso-8859-1?Q?R=E9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <87k4pqj1pc.fsf@gnu.org> ("Ludovic =?iso-8859-1?Q?Court=E8s?= =?iso-8859-1?Q?=22's?= message of "Tue, 22 Jun 2010 21:40:15 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:10549 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Oops, there was a thinko in the patch, whereby wide strings would not be entirely compared. Here=E2=80=99s an updated one: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/libguile/srfi-13.c b/libguile/srfi-13.c index c4e8571..f29ceaa 100644 --- a/libguile/srfi-13.c +++ b/libguile/srfi-13.c @@ -1,6 +1,6 @@ /* srfi-13.c --- SRFI-13 procedures for Guile * - * Copyright (C) 2001, 2004, 2005, 2006, 2008, 2009 Free Software Foundation, Inc. + * Copyright (C) 2001, 2004, 2005, 2006, 2008, 2009, 2010 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -1168,6 +1168,26 @@ SCM_DEFINE (scm_string_eq, "string=", 2, 4, 0, "value otherwise.") #define FUNC_NAME s_scm_string_eq { + if (SCM_LIKELY (scm_i_is_narrow_string (s1) == scm_i_is_narrow_string (s2) + && SCM_UNBNDP (start1) && SCM_UNBNDP (end1) + && SCM_UNBNDP (start2) && SCM_UNBNDP (end2))) + { + size_t len1, len2; + + len1 = scm_i_string_length (s1); + len2 = scm_i_string_length (s2); + + if (SCM_LIKELY (len1 == len2)) + { + if (!scm_i_is_narrow_string (s1)) + len1 *= 4; + + return scm_from_bool (memcmp (scm_i_string_chars (s1), + scm_i_string_chars (s2), + len1) == 0); + } + } + return compare_strings (FUNC_NAME, 0, s1, s2, start1, end1, start2, end2, SCM_BOOL_F, SCM_BOOL_F, SCM_BOOL_F, SCM_BOOL_F, SCM_BOOL_T); --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpMdWRv4oCZLg0K --=-=-=--