NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
128位整数

128位有符号和无符号整数类型的完整实现 更多...

struct  neforce::uint128_t
 128位无符号整数类型 更多...
struct  neforce::int128_t
 128位有符号整数类型 更多...

函数

constexpr uint128_t & neforce::uint128_t::operator*= (const uint128_t &other) noexcept
 乘法赋值
constexpr uint128_t & neforce::uint128_t::operator/= (const uint128_t &other)
 除法赋值
constexpr uint128_t & neforce::uint128_t::operator%= (const uint128_t &other)
 取模赋值
static constexpr void neforce::uint128_t::divmod128 (const uint128_t &dividend, const uint128_t &divisor, uint128_t &quotient, uint128_t &remainder)
 128位除法辅助函数
constexpr int128_t & neforce::int128_t::operator/= (const int128_t &other)
 除法赋值
constexpr int128_t & neforce::int128_t::operator%= (const int128_t &other)
 取模赋值
constexpr int128_t neforce::uint128_t::to_int128 () const noexcept
 转换为有符号128位整数

详细描述

128位有符号和无符号整数类型的完整实现

函数说明

◆ divmod128()

void neforce::uint128_t::divmod128 ( const uint128_t & dividend,
const uint128_t & divisor,
uint128_t & quotient,
uint128_t & remainder )
staticconstexpr

128位除法辅助函数

参数
dividend被除数
divisor除数
quotient输出商
remainder输出余数
异常
math_exception除数为0时抛出

在文件 int128.hpp704 行定义.

引用了 neforce::clz64(), divmod128(), hi, lo , 以及 neforce::remainder().

被这些函数引用 divmod128(), operator%=() , 以及 operator/=().

◆ operator%=() [1/2]

int128_t & neforce::int128_t::operator%= ( const int128_t & other)
constexpr

取模赋值

参数
other右侧操作数
返回
自身引用
异常
math_exception除数为0时抛出

在文件 int128.hpp763 行定义.

引用了 neforce::uint128_t::hi, is_negative(), neforce::uint128_t::lo, negation(), operator%=() , 以及 to_uint128().

被这些函数引用 operator%=().

◆ operator%=() [2/2]

uint128_t & neforce::uint128_t::operator%= ( const uint128_t & other)
constexpr

取模赋值

参数
other右侧操作数
返回
自身引用
异常
math_exception除数为0时抛出

在文件 int128.hpp697 行定义.

引用了 neforce::copy(), divmod128() , 以及 operator%=().

被这些函数引用 operator%=().

◆ operator*=()

uint128_t & neforce::uint128_t::operator*= ( const uint128_t & other)
constexprnoexcept

乘法赋值

参数
other右侧操作数
返回
自身引用

在文件 int128.hpp685 行定义.

引用了 mul128() , 以及 operator*=().

被这些函数引用 operator*=().

◆ operator/=() [1/2]

int128_t & neforce::int128_t::operator/= ( const int128_t & other)
constexpr

除法赋值

参数
other右侧操作数
返回
自身引用
异常
math_exception除数为0时抛出

在文件 int128.hpp749 行定义.

引用了 neforce::uint128_t::hi, is_negative(), neforce::uint128_t::lo, negation(), operator/=() , 以及 to_uint128().

被这些函数引用 operator/=().

◆ operator/=() [2/2]

uint128_t & neforce::uint128_t::operator/= ( const uint128_t & other)
constexpr

除法赋值

参数
other右侧操作数
返回
自身引用
异常
math_exception除数为0时抛出

在文件 int128.hpp690 行定义.

引用了 neforce::copy(), divmod128() , 以及 operator/=().

被这些函数引用 operator/=().

◆ to_int128()

int128_t neforce::uint128_t::to_int128 ( ) const
nodiscardconstexprnoexcept

转换为有符号128位整数

返回
有符号128位整数

在文件 int128.hpp777 行定义.

引用了 hi, lo , 以及 to_int128().

被这些函数引用 to_int128().