Portable implementations of signed and unsigned 128-bit integers
| Master | Develop | |
|---|---|---|
| Drone | ||
| Github Actions | ||
| Codecov |
This library is header only and requires C++14 or newer. It contains no other dependencies.
Simply #include it and use it.
The library is also available as a single header here.
With C++20 and greater you can instead import boost.int128.
You can also try the library out on Compiler Explorer.
git clone https://github.com/boostorg/int128
cd int128
mkdir build && cd build
cmake .. OR cmake .. -DCMAKE_INSTALL_PREFIX=/your/custom/path
cmake --build . --target install
then you can use find_package(boost_int128 REQUIRED)
git clone https://github.com/boostorg/int128
cd int128
vcpkg install int128 --overlay-ports=ports/int128
Boost.Int128 is tested natively on Ubuntu (x86_64, x86_32, s390x, aarch64, ARM32v7), macOS (x86_64, and Apple Silicon), and Windows (x86_64, x86_32, and ARM64); as well as emulated PPC64LE using QEMU with the following compilers:
Int128 provides 2 types:
namespace boost {
namespace int128 {
struct uint128;
struct int128;
} //namespace int128
} //namespace boost
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.).
The entire library can be conveniently included with #include <boost/int128.hpp>
The complete documentation can be found at: https://develop.int128.cpp.al
[int128] tag in the subject line.#boost channel.<h1>Boost.int128 <a href="https://doi.org/10.21105/joss.11293"><img src="https://joss.theoj.org/papers/10.21105/joss.11293/status.svg" alt="DOI" /></a></h1> <p>Portable implementations of signed and unsigned 128-bit integers</p> <table> <thead> <tr> <th align="left"></th> <th align="left">Master</th> <th align="left">Develop</th> </tr> </thead> <tbody> <tr> <td align="left">Drone</td> <td align="left"><a href="https://drone.cpp.al/boostorg/int128"><img src="https://drone.cpp.al/api/badges/boostorg/int128/status.svg?ref=refs/heads/master" alt="Build Status" /></a></td> <td align="left"><a href="https://drone.cpp.al/boostorg/int128"><img src="https://drone.cpp.al/api/badges/boostorg/int128/status.svg?ref=refs/heads/develop" alt="Build Status" /></a></td> </tr> <tr> <td align="left">Github Actions</td> <td align="left"><a href="https://github.com/boostorg/int128/actions/workflows/ci.yml"><img src="https://github.com/boostorg/int128/actions/workflows/ci.yml/badge.svg?branch=master" alt="CI" /></a></td> <td align="left"><a href="https://github.com/boostorg/int128/actions/workflows/ci.yml"><img src="https://github.com/boostorg/int128/actions/workflows/ci.yml/badge.svg?branch=develop" alt="CI" /></a></td> </tr> <tr> <td align="left">Codecov</td> <td align="left"><a href="https://codecov.io/gh/boostorg/int128"><img src="https://codecov.io/gh/boostorg/int128/branch/master/graph/badge.svg?token=KWY7M64xhh" alt="codecov" /></a></td> <td align="left"><a href="https://codecov.io/gh/boostorg/int128"><img src="https://codecov.io/gh/boostorg/int128/graph/badge.svg?token=drvY8nnV5S" alt="codecov" /></a></td> </tr> </tbody> </table> <hr /> <h1>How To Use The Library</h1> <p>This library is header only and requires C++14 or newer. It contains no other dependencies. Simply <code>#include</code> it and use it. The library is also available as a single header <a href="https://github.com/boostorg/int128/blob/develop/extra/single_include/boost/int128.hpp">here</a>. With C++20 and greater you can instead <code>import boost.int128</code>.</p> <p>You can also try the library out on <a href="https://godbolt.org/z/3q4zce41d">Compiler Explorer</a>.</p> <h2>CMake</h2> <pre class="highlightjs highlight"><code class="language-sh hljs">git clone https://github.com/boostorg/int128 cd int128 mkdir build && cd build cmake .. OR cmake .. -DCMAKE_INSTALL_PREFIX=/your/custom/path cmake --build . --target install </code></pre> <p>then you can use <code>find_package(boost_int128 REQUIRED)</code></p> <h2>vcpkg</h2> <pre class="highlightjs highlight"><code class="language-sh hljs">git clone https://github.com/boostorg/int128 cd int128 vcpkg install int128 --overlay-ports=ports/int128 </code></pre> <h1>Supported Platforms</h1> <p>Boost.Int128 is tested natively on Ubuntu (x86_64, x86_32, s390x, aarch64, ARM32v7), macOS (x86_64, and Apple Silicon), and Windows (x86_64, x86_32, and ARM64); as well as emulated PPC64LE using QEMU with the following compilers:</p> <ul> <li>GCC 5 and later</li> <li>Clang 5 and later</li> <li>Visual Studio 2017 (14.1) and later</li> <li>Intel OneAPI DPC++</li> </ul> <h1>Synopsis</h1> <p>Int128 provides 2 types:</p> <pre class="highlightjs highlight"><code class="language-cpp hljs">namespace boost { namespace int128 { struct uint128; struct int128; } //namespace int128 } //namespace boost </code></pre> <p>These types operate like built-in integer types. They have their own implementations of the Standard-Library functions (e.g., like those found in <code><limits></code>, <code><iostream></code>, <code><bit></code> etc.).</p> <p>The entire library can be conveniently included with <code>#include <boost/int128.hpp></code></p> <h1>Full Documentation</h1> <p>The complete documentation can be found at: https://develop.int128.cpp.al</p> <h1>Help and feedback</h1> <ul> <li><strong><a href="https://github.com/boostorg/int128/issues">GitHub Issues</a></strong> for bug reports. Search before opening a new one.</li> <li><strong><a href="https://github.com/boostorg/int128/discussions">GitHub Discussions</a></strong> for questions, design ideas, and general conversation about the library.</li> <li><strong><a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users">Boost mailing list</a></strong> for general Boost development. Use the <code>[int128]</code> tag in the subject line.</li> <li><strong>CppLang Slack</strong> for real-time chat. <a href="https://cppalliance.org/slack/">Request an invite</a>, then join the <code>#boost</code> channel.</li> </ul>
<h1>Boost.int128 <a href="https://doi.org/10.21105/joss.11293"><img src="https://joss.theoj.org/papers/10.21105/joss.11293/status.svg" alt="DOI" /></a></h1> <p>Portable implementations of signed and unsigned 128-bit integers</p> <table> <thead> <tr> <th align="left"></th> <th align="left">Master</th> <th align="left">Develop</th> </tr> </thead> <tbody> <tr> <td align="left">Drone</td> <td align="left"><a href="https://drone.cpp.al/boostorg/int128"><img src="https://drone.cpp.al/api/badges/boostorg/int128/status.svg?ref=refs/heads/master" alt="Build Status" /></a></td> <td align="left"><a href="https://drone.cpp.al/boostorg/int128"><img src="https://drone.cpp.al/api/badges/boostorg/int128/status.svg?ref=refs/heads/develop" alt="Build Status" /></a></td> </tr> <tr> <td align="left">Github Actions</td> <td align="left"><a href="https://github.com/boostorg/int128/actions/workflows/ci.yml"><img src="https://github.com/boostorg/int128/actions/workflows/ci.yml/badge.svg?branch=master" alt="CI" /></a></td> <td align="left"><a href="https://github.com/boostorg/int128/actions/workflows/ci.yml"><img src="https://github.com/boostorg/int128/actions/workflows/ci.yml/badge.svg?branch=develop" alt="CI" /></a></td> </tr> <tr> <td align="left">Codecov</td> <td align="left"><a href="https://codecov.io/gh/boostorg/int128"><img src="https://codecov.io/gh/boostorg/int128/branch/master/graph/badge.svg?token=KWY7M64xhh" alt="codecov" /></a></td> <td align="left"><a href="https://codecov.io/gh/boostorg/int128"><img src="https://codecov.io/gh/boostorg/int128/graph/badge.svg?token=drvY8nnV5S" alt="codecov" /></a></td> </tr> </tbody> </table> <hr /> <h1>How To Use The Library</h1> <p>This library is header only and requires C++14 or newer. It contains no other dependencies. Simply <code>#include</code> it and use it. The library is also available as a single header <a href="https://github.com/boostorg/int128/blob/develop/extra/single_include/boost/int128.hpp">here</a>. With C++20 and greater you can instead <code>import boost.int128</code>.</p> <p>You can also try the library out on <a href="https://godbolt.org/z/3q4zce41d">Compiler Explorer</a>.</p> <h2>CMake</h2> <pre class="highlightjs highlight"><code class="language-sh hljs">git clone https://github.com/boostorg/int128 cd int128 mkdir build && cd build cmake .. OR cmake .. -DCMAKE_INSTALL_PREFIX=/your/custom/path cmake --build . --target install </code></pre> <p>then you can use <code>find_package(boost_int128 REQUIRED)</code></p> <h2>vcpkg</h2> <pre class="highlightjs highlight"><code class="language-sh hljs">git clone https://github.com/boostorg/int128 cd int128 vcpkg install int128 --overlay-ports=ports/int128 </code></pre> <h1>Supported Platforms</h1> <p>Boost.Int128 is tested natively on Ubuntu (x86_64, x86_32, s390x, aarch64, ARM32v7), macOS (x86_64, and Apple Silicon), and Windows (x86_64, x86_32, and ARM64); as well as emulated PPC64LE using QEMU with the following compilers:</p> <ul> <li>GCC 5 and later</li> <li>Clang 5 and later</li> <li>Visual Studio 2017 (14.1) and later</li> <li>Intel OneAPI DPC++</li> </ul> <h1>Synopsis</h1> <p>Int128 provides 2 types:</p> <pre class="highlightjs highlight"><code class="language-cpp hljs">namespace boost { namespace int128 { struct uint128; struct int128; } //namespace int128 } //namespace boost </code></pre> <p>These types operate like built-in integer types. They have their own implementations of the Standard-Library functions (e.g., like those found in <code><limits></code>, <code><iostream></code>, <code><bit></code> etc.).</p> <p>The entire library can be conveniently included with <code>#include <boost/int128.hpp></code></p> <h1>Full Documentation</h1> <p>The complete documentation can be found at: https://develop.int128.cpp.al</p> <h1>Help and feedback</h1> <ul> <li><strong><a href="https://github.com/boostorg/int128/issues">GitHub Issues</a></strong> for bug reports. Search before opening a new one.</li> <li><strong><a href="https://github.com/boostorg/int128/discussions">GitHub Discussions</a></strong> for questions, design ideas, and general conversation about the library.</li> <li><strong><a href="http://lists.boost.org/mailman/listinfo.cgi/boost-users">Boost mailing list</a></strong> for general Boost development. Use the <code>[int128]</code> tag in the subject line.</li> <li><strong>CppLang Slack</strong> for real-time chat. <a href="https://cppalliance.org/slack/">Request an invite</a>, then join the <code>#boost</code> channel.</li> </ul>