beman::big_int: A reference implementation for P4444
Introduction
C++ currently provides no portable support for integers wider than 64 bits.
This is one of the oldest and most widely recognized gaps in the language, which authors have attempted to fill several times, and all proposed a std::integer class with infinite precision.
Each of these attempts failed — not because there was a lack of interest or motivation, but because the task turned out to be too great of a challenge.
std::big_int is to long long what std::string is to char[N]: sure, a fixed size is sufficient for some use cases, but comes with a constant threat of overflow and undefined behavior, and that threat is easily eliminated at some acceptable runtime cost.
Motivation
This repository contains our reference implementation of std::big_int as beman::big_int.
It is designed to be both portable and performant, with all features specified in P4444.