From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11226 Path: news.gmane.org!.POSTED!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: byteswap.h Date: Fri, 7 Apr 2017 14:01:04 -0400 Message-ID: <20170407180104.GS17319@brightrain.aerifal.cx> References: <225ea64f-f051-1a61-0ba2-db9f27d1ba68@gmail.com> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1491588085 22623 195.159.176.226 (7 Apr 2017 18:01:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Apr 2017 18:01:25 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11241-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 07 20:01:21 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cwYC8-0004Tz-13 for gllmg-musl@m.gmane.org; Fri, 07 Apr 2017 20:01:12 +0200 Original-Received: (qmail 26534 invoked by uid 550); 7 Apr 2017 18:01:16 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 26512 invoked from network); 7 Apr 2017 18:01:15 -0000 Content-Disposition: inline In-Reply-To: <225ea64f-f051-1a61-0ba2-db9f27d1ba68@gmail.com> Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:11226 Archived-At: On Fri, Apr 07, 2017 at 07:53:09PM +0200, fab10 wrote: > I had a look at byteswap.h and it seems to me that the code is not > very efficient. Every function in this header could be translated in > a single assembly instruction with the gcc intrinsics: > > __builtin_bswap16 > __builtin_bswap32 > __builtin_bswap64 > > Is there a reason to not use these gcc intrinsics? Because the compile should be (and as far as I know, is) generating the optimal single instructions from the portable C, without the need for hackish non-portable intrinsics. Rich