From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11227 Path: news.gmane.org!.POSTED!not-for-mail From: Joakim Sindholt Newsgroups: gmane.linux.lib.musl.general Subject: Re: byteswap.h Date: Fri, 7 Apr 2017 20:07:42 +0200 Message-ID: <20170407180742.GB8704@wirbelwind> 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 1491588476 9940 195.159.176.226 (7 Apr 2017 18:07:56 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 7 Apr 2017 18:07:56 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) To: musl@lists.openwall.com Original-X-From: musl-return-11242-gllmg-musl=m.gmane.org@lists.openwall.com Fri Apr 07 20:07:51 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 1cwYIY-0001x9-Oh for gllmg-musl@m.gmane.org; Fri, 07 Apr 2017 20:07:50 +0200 Original-Received: (qmail 11553 invoked by uid 550); 7 Apr 2017 18:07:55 -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 11532 invoked from network); 7 Apr 2017 18:07:54 -0000 Content-Disposition: inline In-Reply-To: <225ea64f-f051-1a61-0ba2-db9f27d1ba68@gmail.com> Xref: news.gmane.org gmane.linux.lib.musl.general:11227 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? > > Bye > While musl does employ GNU C features in quite a few places it's just plain unnecessary here. https://godbolt.org/g/eLZWwI When optimized those functions yield a single bswap instruction anyway, because GCC is smart enough to deduce this.