From: "Jₑₙₛ Gustedt" <jens.gustedt@inria.fr>
To: Rich Felker <dalias@libc.org>
Cc: musl@lists.openwall.com
Subject: Re: [musl] [C23 new stdlib 2/4] C23: add the memalignment function
Date: Thu, 25 May 2023 11:16:53 +0200 [thread overview]
Message-ID: <20230525111653.4b0175d3@inria.fr> (raw)
In-Reply-To: <20230524212835.GC4163@brightrain.aerifal.cx>
[-- Attachment #1: Type: text/plain, Size: 1920 bytes --]
Rich,
on Wed, 24 May 2023 17:28:35 -0400 you (Rich Felker <dalias@libc.org>)
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
<stdbit.h>, please let me know. They are hard to find in search
engines.
For `__builtin_ctzll`, hm, I counted also to use these for the
<stdbit.h> 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 <stdbit.h>? 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ₑₙₛ
--
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2023-05-25 9:17 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-24 19:38 [musl] [C23 new stdlib 0/4] changes in stdlib.h Jens Gustedt
2023-05-24 19:38 ` [musl] [C23 new stdlib 1/4] C23: add the new interfaces free_sized and free_aligned_sized for stdlib.h Jens Gustedt
2023-05-24 21:31 ` Rich Felker
2023-05-25 9:38 ` Jₑₙₛ Gustedt
2023-05-25 12:57 ` Rich Felker
2023-05-24 19:38 ` [musl] [C23 new stdlib 2/4] C23: add the memalignment function Jens Gustedt
2023-05-24 21:28 ` Rich Felker
2023-05-24 22:12 ` Rich Felker
2023-05-25 9:17 ` Jₑₙₛ Gustedt
2023-05-25 9:16 ` Jₑₙₛ Gustedt [this message]
2023-05-25 9:42 ` NRK
2023-05-25 13:07 ` Rich Felker
2023-05-25 14:05 ` Jₑₙₛ Gustedt
2023-05-25 14:34 ` Rich Felker
2023-05-25 15:22 ` Jₑₙₛ Gustedt
2023-06-01 13:35 ` Alexander Monakov
2023-06-01 19:08 ` Rich Felker
2023-06-02 8:07 ` Jₑₙₛ Gustedt
2023-06-02 8:03 ` Jₑₙₛ Gustedt
2023-06-02 8:37 ` Alexander Monakov
2023-05-24 19:38 ` [musl] [C23 new stdlib 3/4] C23: implement the new strfrom[dfl] functions Jens Gustedt
2023-05-24 21:42 ` Rich Felker
2023-05-24 19:38 ` [musl] [C23 new stdlib 4/4] C23: add the new include guard to stdlib.h Jens Gustedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230525111653.4b0175d3@inria.fr \
--to=jens.gustedt@inria.fr \
--cc=dalias@libc.org \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).