C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Modular integers

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Wed, 14 Jan 2026 16:41:18 +0100
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_at_[hidden]> Gesendet:Mi 14.01.2026 15:47 Betreff:Re: [std-proposals] Modular integers An:std-proposals_at_[hidden]; CC:Sebastian Wittmeier <wittmeier_at_[hidden]>; > On 14 Jan 2026, at 10:59, Sebastian Wittmeier via Std-Proposals <std-proposals_at_[hidden]> wrote: > > Von: Hans Åberg via Std-Proposals <std-proposals_at_[hidden]> > Gesendet: Mi 14.01.2026 11:04 > Betreff: Re: [std-proposals] Modular integers > An: Jan Schultke <janschultke_at_[hidden]>; > CC: Hans Åberg <haberg_1_at_[hidden]>; std-proposals_at_[hidden]; > > > 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.

Received on 2026-01-14 15:57:15