From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 605f901: Prefer memcpy and memset to doing it by hand Date: Fri, 05 Feb 2016 08:25:11 -0500 Message-ID: References: <20160205003917.14369.86929@vcs.savannah.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1454678740 11932 80.91.229.3 (5 Feb 2016 13:25:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Feb 2016 13:25:40 +0000 (UTC) Cc: Paul Eggert To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 05 14:25:32 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aRgOB-0008Pl-US for ged-emacs-devel@m.gmane.org; Fri, 05 Feb 2016 14:25:32 +0100 Original-Received: from localhost ([::1]:48296 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgOB-0003MB-7x for ged-emacs-devel@m.gmane.org; Fri, 05 Feb 2016 08:25:31 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46929) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgNx-0003M1-UQ for emacs-devel@gnu.org; Fri, 05 Feb 2016 08:25:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aRgNs-0003dj-VJ for emacs-devel@gnu.org; Fri, 05 Feb 2016 08:25:17 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:29017) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aRgNs-0003cW-RB for emacs-devel@gnu.org; Fri, 05 Feb 2016 08:25:12 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A9FgA731xV/96XpUVcgxCEAoVVwwsEAgKBPD0QAQEBAQEBAYEKQQWDXQEBBCcvIxALNBIUGA2IY88jAQEBAQYBAQEBHos6hQUHFoQXBYwwpw+BRSOBZoIwIIJ4AQEB X-IPAS-Result: A0A9FgA731xV/96XpUVcgxCEAoVVwwsEAgKBPD0QAQEBAQEBAYEKQQWDXQEBBCcvIxALNBIUGA2IY88jAQEBAQYBAQEBHos6hQUHFoQXBYwwpw+BRSOBZoIwIIJ4AQEB X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="192466017" Original-Received: from 69-165-151-222.dsl.teksavvy.com (HELO pastel.home) ([69.165.151.222]) by ironport2-out.teksavvy.com with ESMTP; 05 Feb 2016 08:25:11 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 23E52602B9; Fri, 5 Feb 2016 08:25:11 -0500 (EST) In-Reply-To: (Paul Eggert's message of "Fri, 05 Feb 2016 00:39:17 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:199379 Archived-At: > + if (XLI (init) == 0) > + memset (p->contents, 0, XFASTINT (length) * sizeof p->contents[0]); > + else > + for (ptrdiff_t i = 0; i < XFASTINT (length); i++) > + p->contents[i] = init; FWIW, I much prefer keeping just the loop, over using this "if+memset" which seems like an obvious case or too-early-optimization. Stefan