Standard library functions are not necessarily implemented as functions (e.g. C functions), but an implementation (the LLVM compiler) may emit any intermediate representation or assembler code for it. It can expand it statically, whether it is defined as templates or not.
-----Ursprüngliche Nachricht-----
Von: Hans Åberg <haberg_1@icloud.com>
Gesendet: Mi 14.01.2026 15:47
Betreff: Re: [std-proposals] Modular integers
An: std-proposals@lists.isocpp.org;
CC: Sebastian Wittmeier <wittmeier@projectalpha.org>;
> On 14 Jan 2026, at 10:59, Sebastian Wittmeier via Std-Proposals <std-proposals@lists.isocpp.org> wrote:
>
> Von: Hans Åberg via Std-Proposals <std-proposals@lists.isocpp.org>
> Gesendet: Mi 14.01.2026 11:04
> Betreff: Re: [std-proposals] Modular integers
> An: Jan Schultke <janschultke@googlemail.com>;
> CC: Hans Åberg <haberg_1@icloud.com>; std-proposals@lists.isocpp.org;
>
> > If you have an optimization opportunity that LLVM does not take, why don't you make an LLVM PR or bug report instead of a C++ proposal?
>
> The optimizations are not a part of a C++ proposal, clearly, since the standard does not make such statements. There is usually a requirement of at least one fairly efficient implementation, leaving it open for improvements, and that is what I indicated.
>
> The LLVM code is in C, so templates won't help there. They seem happy with what they have.
>
> That is "their problem", they can create a C++ interpreter inside the compiler, if needed to create the resulting efficient code.
> Or hardcode the problem for any bit width from 1 to 4096 bits.
> Typically this functionality could be done in C with recursive function calls?
I was thinking the code being expanded statically for pipelining, but perhaps it can be done with inlined function calls. Something to try. Then open still has make functions for a series of different words.