C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::big_int

From: Matt Borland <matt_at_[hidden]>
Date: Fri, 03 Apr 2026 14:17:55 +0000
>

> Yeah, P3161 provides the low-level operations that are used to implement those higher-level algorithms such as Karatsuba. Regardless of which high-level algorithm you choose, you reduce the instruction count significantly if you can compute the high bits of a multiplication at the same time as the low bits. If you didn't have the standard operation such as std::mul_wide, you would implement that yourself in terms of __int128 multiplication or something else, so there's no way around it. It's somewhere in the implementation of std::big_int.

For internal usage sure. We could either wait and see, or use the same signature as P3161, and leave a comment that says this could be replaced in the future. I know implementations of these functions in some form exist in several boost libs.

Matt

Received on 2026-04-03 14:18:04