Date: Tue, 25 Nov 2025 21:20:15 -0500
On Nov 25, 2025, at 7:57 PM, Lev Minkovsky via Std-Proposals <std-proposals_at_[hidden]> wrote:
>
> If we are to force implementers to have long long long as at least 128 bit, we will risk the embedded community to simply reject/not implement this proposal as too burdensome and irrelevant.
Data point: Here is a (open source) library implementation of 128 bit integers (https://github.com/HowardHinnant/bbi) that can be built on top of native 8 bit, 16 bit, 32 bit, or 64 bit integers. Simply #define BBI_LIMIT 16 to base it on 16 bit integers (for example). It works by making the “extended” integers composed of a low-half and high-half, and doesn’t require the halves to be native integers.
I won’t claim that it has the utmost efficiency for all applicactions. I simply present it as an existence proof that 128 bit arithmetic is reasonably implementable on all platforms supporting at least 8 bit arithmetic.
For those platforms where CHAR_BIT != 8, such as 24 bit platforms (which I’ve worked on), the same logic could be used to to support bit widths of 48, 96, 192, etc.
I also must credit Hacker’s Delight, 2nd Edition (https://en.wikipedia.org/wiki/Hacker%27s_Delight) for the code and explanation for how to do all this. It presents only 64 bit implemented in terms of 32 bit. But if the algorithms are applied recursively, as is easily doable with C++ templates, you can achieve things like 128 bit implemented in terms of 8 bit.
Howard
>
> If we are to force implementers to have long long long as at least 128 bit, we will risk the embedded community to simply reject/not implement this proposal as too burdensome and irrelevant.
Data point: Here is a (open source) library implementation of 128 bit integers (https://github.com/HowardHinnant/bbi) that can be built on top of native 8 bit, 16 bit, 32 bit, or 64 bit integers. Simply #define BBI_LIMIT 16 to base it on 16 bit integers (for example). It works by making the “extended” integers composed of a low-half and high-half, and doesn’t require the halves to be native integers.
I won’t claim that it has the utmost efficiency for all applicactions. I simply present it as an existence proof that 128 bit arithmetic is reasonably implementable on all platforms supporting at least 8 bit arithmetic.
For those platforms where CHAR_BIT != 8, such as 24 bit platforms (which I’ve worked on), the same logic could be used to to support bit widths of 48, 96, 192, etc.
I also must credit Hacker’s Delight, 2nd Edition (https://en.wikipedia.org/wiki/Hacker%27s_Delight) for the code and explanation for how to do all this. It presents only 64 bit implemented in terms of 32 bit. But if the algorithms are applied recursively, as is easily doable with C++ templates, you can achieve things like 128 bit implemented in terms of 8 bit.
Howard
Received on 2025-11-26 02:20:50
