Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ int128 is under active development and is not an official boost library.

This library is header only. It contains no other dependencies.
Simply `#include` it and use it.
With C++20 and greater you can instead `import boost.int128`.

## CMake

Expand Down Expand Up @@ -64,7 +65,7 @@ struct int128_t;

These types operate like built-in integer types.
They have their own implementations of the Standard-Library functions
(e.g. like those found in `<limits>`, `<iostream>`, `<bit>` etc.).
(e.g., like those found in `<limits>`, `<iostream>`, `<bit>` etc.).

The entire library can be conveniently included with `#include <boost/int128.hpp>`

Expand Down
14 changes: 10 additions & 4 deletions doc/modules/ROOT/pages/overview.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ Matt Borland
Boost.Int128 is a portable implementation of a signed, and an unsigned 128-bit integer and related functionality (i.e. `<bit>`, `<iostream>`, etc).
Importantly, on all platforms, the `sizeof` the types provided in this library are exactly 128-bits.

The library is header-only, has no dependencies, and requires only C++14.
The library is header-only, has no dependencies, and requires only pass:[C++14].
When using pass:[C++20] or newer, the library can be consumed as a module `import boost.int128`.

== Motivation

128-bit integers are remarkably useful in a number of domains, but portability is often an issue.
An example is a 64-bit machine running Linux (say Ubuntu 24.04) has `__int128`, but the same exact machine running Windows does not have this type.
128-bit integers are useful across many domains, but pass:[C++] provides no portable way to use them.
GCC and Clang offer `__int128` as a non-standard extension on 64-bit targets, but it lacks `std::numeric_limits` specializations, `<iostream>` support, and is absent entirely on MSVC.
Multiprecision libraries can fill the gap, but typically at the cost of a larger `sizeof` and additional overhead.
Boost.Int128 solves this by providing types that are exactly 128-bits on every platform.
Operation implementations rely on compiler intrinsic where available for native performance, and optimized software implementations elsewhere.

== Use Cases

Anywhere 128-bit integers are needed.
* **Networking** — IPv6 addresses are 128 bits wide; a single integer makes masking, comparison, and arithmetic straightforward.
* **Unique identifiers** — UUIDs / GUIDs are 128-bit values commonly used as database keys and distributed system identifiers.
* **Scientific and Financial computing** — Extended-range accumulators, large combinatorial values, and algorithms that need overflow-free 64×64 multiplication.

== Supported Compilers

Expand Down