API Reference

Namespaces

Namespace Description

boost::int128

Contains all components of the library except <charconv> functionality

boost::int128::literals

User-defined literals for 128-bit integers

Types

Type Description

uint128_t

Unsigned 128-bit integer

int128_t

Signed 128-bit integer

Literals

Literal Description

_u128

Unsigned 128-bit literal (lowercase)

_U128

Unsigned 128-bit literal (uppercase)

_i128

Signed 128-bit literal (lowercase)

_I128

Signed 128-bit literal (uppercase)

Structures

Structure Description

std::numeric_limits<uint128_t>

Numeric limits specialization for uint128_t

std::numeric_limits<int128_t>

Numeric limits specialization for int128_t

u128div_t

Result type for div(uint128_t, uint128_t)

i128div_t

Result type for div(int128_t, int128_t)

Functions

Listed by analogous STL header.

<bit>

Function Description

has_single_bit

Checks if value is a power of two

countl_zero

Counts leading zeros

countl_one

Counts leading ones

bit_width

Returns minimum bits needed to represent value

bit_ceil

Rounds up to nearest power of two

bit_floor

Rounds down to nearest power of two

countr_zero

Counts trailing zeros

countr_one

Counts trailing ones

rotl

Rotates bits left

rotr

Rotates bits right

popcount

Counts number of set bits

byteswap

Reverses byte order

<charconv>

Function Description

to_chars

Converts integer to character sequence

from_chars

Converts character sequence to integer

<cmath>

Function Description

abs

Absolute value

<cstdlib>

Function Description

div

Computes quotient and remainder simultaneously

Formatting

Library Description

<format>

C++20 std::format support

{fmt}

{fmt} library support

<iostream>

Operator Description

operator<<

Stream insertion operator

operator>>

Stream extraction operator

<ios>

Manipulator Description

std::oct

Octal output format

std::dec

Decimal output format

std::hex

Hexadecimal output format

std::uppercase

Uppercase hex digits

std::nouppercase

Lowercase hex digits

<numeric>

Function Description

add_sat

Saturating addition

sub_sat

Saturating subtraction

mul_sat

Saturating multiplication

div_sat

Saturating division

saturate_cast

Saturating type cast

gcd

Greatest common divisor

lcm

Least common multiple

midpoint

Midpoint between two values

Macros

Constants (<boost/int128/climits.hpp>)

Macro Description

BOOST_INT128_UINT128_MAX

Maximum value for uint128_t

BOOST_INT128_INT128_MAX

Maximum value for int128_t

BOOST_INT128_INT128_MIN

Minimum value for int128_t

Literals

Macro Description

BOOST_INT128_UINT128_C

Unsigned 128-bit constant macro

BOOST_INT128_INT128_C

Signed 128-bit constant macro

Configuration

User Configuration

Macro Description

BOOST_INT128_NO_BUILTIN_INT128

Disables use of compiler built-in __int128

BOOST_INT128_ALLOW_SIGN_COMPARE

Allows comparison between signed and unsigned types

BOOST_INT128_ALLOW_SIGN_CONVERSION

Allows implicit sign conversion

BOOST_INT128_DISABLE_EXCEPTIONS

Disables exception throwing

Automatic Configuration

Macro Description

BOOST_INT128_HAS_INT128

Defined if compiler provides __int128

BOOST_INT128_ENDIAN_LITTLE_BYTE

Defined on little-endian systems

BOOST_INT128_ENDIAN_BIG_BYTE

Defined on big-endian systems