From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 29970 invoked from network); 25 May 2023 09:17:33 -0000 Received: from second.openwall.net (193.110.157.125) by inbox.vuxu.org with ESMTPUTF8; 25 May 2023 09:17:33 -0000 Received: (qmail 12266 invoked by uid 550); 25 May 2023 09:17:30 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 12231 invoked from network); 25 May 2023 09:17:29 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=inria.fr; s=dc; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version; bh=J0eYFSI+AVjhugZalAl54fBPxAiI62Ea7YIVJIioLKg=; b=VUpmIyfaOS2YzZMFuxxEalnELFyyq6mZj23IEx+3xcPEBrsGAFZNbkoE hVXjg3OvbOJME26fOYzpuUemcrocmT6ZbMID1z1Kk+gJH1K5lHFp9rqTM WQdEH8SHTMUHtHnEch8d0APOoU5rZMFAKT4nB6f+9wimZE31FWIre1jVO s=; Authentication-Results: mail3-relais-sop.national.inria.fr; dkim=none (message not signed) header.i=none; spf=SoftFail smtp.mailfrom=jens.gustedt@inria.fr; dmarc=fail (p=none dis=none) d=inria.fr X-IronPort-AV: E=Sophos;i="6.00,190,1681164000"; d="scan'208";a="56965461" Date: Thu, 25 May 2023 11:16:53 +0200 From: =?UTF-8?B?SuKCkeKCmeKCmw==?= Gustedt To: Rich Felker Cc: musl@lists.openwall.com Message-ID: <20230525111653.4b0175d3@inria.fr> In-Reply-To: <20230524212835.GC4163@brightrain.aerifal.cx> References: <1fe28ea2525f112264a1a819d8ce50a97504ab8b.1684932892.git.Jens.Gustedt@inria.fr> <20230524212835.GC4163@brightrain.aerifal.cx> Organization: inria.fr X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.33; x86_64-pc-linux-gnu) X-Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAAXNSR0IArs4c6QAAACRQTFRFERslNjAsLTE9Ok9wUk9TaUs8iWhSrYZkj42Rz6aD3sGZ MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/.BmOcYGJQW=YGG75Ivxi5g7"; protocol="application/pgp-signature"; micalg=pgp-sha1 Subject: Re: [musl] [C23 new stdlib 2/4] C23: add the memalignment function --Sig_/.BmOcYGJQW=YGG75Ivxi5g7 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Rich, on Wed, 24 May 2023 17:28:35 -0400 you (Rich Felker ) wrote: > There's a more efficient implementation of this function which does > not depend on __builtin_ctzll (which we don't): p^(p-1)&p yes, nice If you have other such nice formulas for some of the interfaces in , please let me know. They are hard to find in search engines. For `__builtin_ctzll`, hm, I counted also to use these for the interfaces. I think the intent of those is really to provide instruction level support of these bit functionalities that avoids going through function calls. I see that we use other quite specific builtins, such as `__builtin_fma`. Is there a particular reason not to have the bit level ones? So you want me to use the ctz and clz interfaces from the internal atomics for the implementation of ? Are they not overkill for this simple purpose? (I mean they are meant to be atomic, arent't they?) > I'm not clear that there's a really good motivation for having it > implemented in the header. It kinda falls under the "maybe do it > because it's easy" case, but once you switch to the non-GNUC-specific > version, it needs a static inline function to avoid multiple > evaluation, I guess using `({ ... })` would also not be acceptable? > and then it gets to the point of "this is really too much > code to have in a header" (which is more an issue of avoiding > "creative" content in headers than anything else). You probably won't like what I have now for the bit operations, then :-( Thanks J=E2=82=91=E2=82=99=E2=82=9B --=20 :: ICube :::::::::::::::::::::::::::::: deputy director :: :: Universit=C3=A9 de Strasbourg :::::::::::::::::::::: ICPS :: :: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus :: :: :::::::::::::::::::::::::::::::::::: =E2=98=8E +33 368854536 :: :: https://icube-icps.unistra.fr/index.php/Jens_Gustedt :: --Sig_/.BmOcYGJQW=YGG75Ivxi5g7 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iF0EARECAB0WIQSN9stI2OFN1pLljN0P0+hp2tU34gUCZG8nhQAKCRAP0+hp2tU3 4kTaAJ4ozmN/kFCqXOWSDDgc8Mss9ZW0KgCePK9+mp0FVEONdKypPTmCqZNML1E= =KilH -----END PGP SIGNATURE----- --Sig_/.BmOcYGJQW=YGG75Ivxi5g7--