NexusForce 1.0.0
A rigorously engineered full-stack C++ backend library.
载入中...
搜索中...
未找到
neforce::uint128_t结构体 参考

128位无符号整数类型 更多...

#include <int128.hpp>

类 neforce::uint128_t 继承关系图:
[图例]

Public 成员函数

constexpr uint128_t (const int32_t low) noexcept
 从32位有符号整数构造
constexpr uint128_t (const uint32_t low) noexcept
 从32位无符号整数构造
constexpr uint128_t (const unsigned long low) noexcept
 从无符号 long 构造
constexpr uint128_t (const unsigned long long low) noexcept
 从无符号 long long 构造
constexpr uint128_t (const uint64_t high, const uint64_t low) noexcept
 从高低64位构造
constexpr int128_t to_int128 () const noexcept
 转换为有符号128位整数
constexpr bool equal_to (const uint128_t &rhs) const noexcept
 相等比较
constexpr bool less_than (const uint128_t &rhs) const noexcept
 小于比较
constexpr uint128_t negation () const noexcept
 取负
constexpr uint128_t & operator+= (const uint128_t &other) noexcept
 加法赋值
constexpr uint128_t & operator-= (const uint128_t &other) noexcept
 减法赋值
constexpr uint128_t & operator*= (const uint128_t &other) noexcept
 乘法赋值
constexpr uint128_t & operator/= (const uint128_t &other)
 除法赋值
constexpr uint128_t & operator%= (const uint128_t &other)
 取模赋值
constexpr uint128_t & operator++ () noexcept
 前置自增
constexpr uint128_t & operator-- () noexcept
 前置自减
constexpr uint128_t operator~ () const noexcept
 按位取反
constexpr uint128_t & operator&= (const uint128_t &other) noexcept
 按位与赋值
constexpr uint128_t & operator|= (const uint128_t &other) noexcept
 按位或赋值
constexpr uint128_t & operator^= (const uint128_t &other) noexcept
 按位异或赋值
constexpr uint128_t & operator<<= (const uint32_t shift) noexcept
 左移赋值
constexpr uint128_t & operator>>= (const uint32_t shift) noexcept
 右移赋值
constexpr uint64_t div64 (const uint64_t divisor, uint64_t *remainder=nullptr) const
 64位除法
constexpr size_t to_hash () const noexcept
 计算哈希值
Public 成员函数 继承自 neforce::icomparable< uint128_t >
constexpr bool operator== (const uint128_t &rhs) const noexcept(noexcept(derived().equal_to(rhs)))
 相等比较运算符
constexpr bool operator!= (const uint128_t &rhs) const noexcept(noexcept(!(derived().equal_to(rhs))))
 不等比较运算符
constexpr bool operator< (const uint128_t &rhs) const noexcept(noexcept(derived().less_than(rhs)))
 小于比较运算符
constexpr bool operator> (const uint128_t &rhs) const noexcept(noexcept(rhs.less_than(derived())))
 大于比较运算符
constexpr bool operator<= (const uint128_t &rhs) const noexcept(noexcept(!(rhs.less_than(derived()))))
 小于等于比较运算符
constexpr bool operator>= (const uint128_t &rhs) const noexcept(noexcept(!(derived().less_than(rhs))))
 大于等于比较运算符
Public 成员函数 继承自 neforce::ihashable< uint128_t >
constexpr size_t to_ihash () const noexcept(noexcept(derived().to_hash()))
 获取对象的哈希值
Public 成员函数 继承自 neforce::iarithmetic< uint128_t >
constexpr uint128_t operator+ (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator+=(other)))
 加法运算符
constexpr uint128_t operator- (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator-=(other)))
 减法运算符
constexpr uint128_t operator* (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator*=(other)))
 乘法运算符
constexpr uint128_t operator/ (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator/=(other)))
 除法运算符
constexpr uint128_t operator% (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator%=(other)))
 取模运算符
constexpr uint128_toperator+= (const uint128_t &other) noexcept(noexcept(derived().operator+=(other)))
 加法赋值运算符
constexpr uint128_toperator-= (const uint128_t &other) noexcept(noexcept(derived().operator-=(other)))
 减法赋值运算符
constexpr uint128_toperator*= (const uint128_t &other) noexcept(noexcept(derived().operator*=(other)))
 乘法赋值运算符
constexpr uint128_toperator/= (const uint128_t &other)
 除法赋值运算符
constexpr uint128_toperator%= (const uint128_t &other)
 取模赋值运算符
constexpr uint128_toperator++ () noexcept(noexcept(derived().operator++()))
 前置自增运算符
constexpr uint128_toperator-- () noexcept(noexcept(derived().operator--()))
 前置自减运算符
Public 成员函数 继承自 neforce::ibinary< uint128_t >
constexpr uint128_t operator& (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator&=(other)))
 按位与运算符
constexpr uint128_t operator| (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator|=(other)))
 按位或运算符
constexpr uint128_t operator^ (const uint128_t &other) const noexcept(noexcept(const_cast< uint128_t & >(derived()).operator^=(other)))
 按位异或运算符
constexpr uint128_t operator~ () const noexcept(noexcept(derived().operator~()))
 按位取反运算符
constexpr uint128_t operator<< (const uint32_t shift) const
 左移运算符
constexpr uint128_t operator>> (const uint32_t shift) const
 右移运算符
constexpr uint128_toperator&= (const uint128_t &other) noexcept(noexcept(derived().operator&=(other)))
 按位与赋值运算符
constexpr uint128_toperator|= (const uint128_t &other) noexcept(noexcept(derived().operator|=(other)))
 按位或赋值运算符
constexpr uint128_toperator^= (const uint128_t &other) noexcept(noexcept(derived().operator^=(other)))
 按位异或赋值运算符
constexpr uint128_toperator<<= (const uint32_t shift)
 左移赋值运算符
constexpr uint128_toperator>>= (const uint32_t shift)
 右移赋值运算符

静态 Public 成员函数

static constexpr uint128_t mul64 (const uint64_t a, const uint64_t b) noexcept
 64位乘法
static constexpr uint128_t mul128 (const uint128_t &a, const uint128_t &b) noexcept
 128位乘法辅助函数
static constexpr void divmod128 (const uint128_t &dividend, const uint128_t &divisor, uint128_t &quotient, uint128_t &remainder)
 128位除法辅助函数
static constexpr uint128_t min () noexcept
 获取最小值
static constexpr uint128_t max () noexcept
 获取最大值

Public 属性

uint64_t lo {0}
 低64位
uint64_t hi {0}
 高64位

详细描述

128位无符号整数类型

在文件 int128.hpp30 行定义.

构造及析构函数说明

◆ uint128_t() [1/5]

neforce::uint128_t::uint128_t ( const int32_t low)
inlineconstexprnoexcept

从32位有符号整数构造

参数
low低32位值

在文件 int128.hpp41 行定义.

引用了 hi , 以及 lo.

◆ uint128_t() [2/5]

neforce::uint128_t::uint128_t ( const uint32_t low)
inlineconstexprnoexcept

从32位无符号整数构造

参数
low低32位值

在文件 int128.hpp49 行定义.

引用了 lo.

◆ uint128_t() [3/5]

neforce::uint128_t::uint128_t ( const unsigned long low)
inlineconstexprnoexcept

从无符号 long 构造

参数
low无符号 long 值

在文件 int128.hpp56 行定义.

引用了 lo.

◆ uint128_t() [4/5]

neforce::uint128_t::uint128_t ( const unsigned long long low)
inlineconstexprnoexcept

从无符号 long long 构造

参数
low无符号 long long 值

在文件 int128.hpp63 行定义.

引用了 lo.

◆ uint128_t() [5/5]

neforce::uint128_t::uint128_t ( const uint64_t high,
const uint64_t low )
inlineconstexprnoexcept

从高低64位构造

参数
high高64位
low低64位

在文件 int128.hpp71 行定义.

引用了 hi , 以及 lo.

成员函数说明

◆ div64()

uint64_t neforce::uint128_t::div64 ( const uint64_t divisor,
uint64_t * remainder = nullptr ) const
inlinenodiscardconstexpr

64位除法

参数
divisor除数
remainder输出余数指针(可为空)
返回

在文件 int128.hpp303 行定义.

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

◆ equal_to()

bool neforce::uint128_t::equal_to ( const uint128_t & rhs) const
inlinenodiscardconstexprnoexcept

相等比较

参数
rhs右侧操作数
返回
是否相等

在文件 int128.hpp100 行定义.

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

被这些函数引用 equal_to().

◆ less_than()

bool neforce::uint128_t::less_than ( const uint128_t & rhs) const
inlinenodiscardconstexprnoexcept

小于比较

参数
rhs右侧操作数
返回
是否小于

在文件 int128.hpp109 行定义.

引用了 hi , 以及 lo.

◆ max()

constexpr uint128_t neforce::uint128_t::max ( )
inlinestaticconstexprnoexcept

获取最大值

返回
最大值

在文件 int128.hpp381 行定义.

◆ min()

constexpr uint128_t neforce::uint128_t::min ( )
inlinestaticconstexprnoexcept

获取最小值

返回
最小值(0)

在文件 int128.hpp375 行定义.

◆ mul128()

constexpr uint128_t neforce::uint128_t::mul128 ( const uint128_t & a,
const uint128_t & b )
inlinestaticnodiscardconstexprnoexcept

128位乘法辅助函数

参数
a第一个乘数
b第二个乘数
返回
128位乘积

在文件 int128.hpp339 行定义.

引用了 neforce::_addcarry_u64(), neforce::_umul128(), hi , 以及 lo.

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

◆ mul64()

constexpr uint128_t neforce::uint128_t::mul64 ( const uint64_t a,
const uint64_t b )
inlinestaticnodiscardconstexprnoexcept

64位乘法

参数
a第一个乘数
b第二个乘数
返回
128位乘积

在文件 int128.hpp285 行定义.

引用了 neforce::_umul128(), hi , 以及 lo.

◆ negation()

uint128_t neforce::uint128_t::negation ( ) const
inlinenodiscardconstexprnoexcept

取负

返回
二补数结果

在文件 int128.hpp117 行定义.

引用了 hi , 以及 lo.

◆ operator&=()

uint128_t & neforce::uint128_t::operator&= ( const uint128_t & other)
inlineconstexprnoexcept

按位与赋值

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

在文件 int128.hpp203 行定义.

引用了 hi , 以及 lo.

◆ operator++()

uint128_t & neforce::uint128_t::operator++ ( )
inlineconstexprnoexcept

前置自增

返回
自身引用

在文件 int128.hpp184 行定义.

◆ operator+=()

uint128_t & neforce::uint128_t::operator+= ( const uint128_t & other)
inlineconstexprnoexcept

加法赋值

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

在文件 int128.hpp128 行定义.

引用了 neforce::_addcarry_u64(), hi , 以及 lo.

◆ operator--()

uint128_t & neforce::uint128_t::operator-- ( )
inlineconstexprnoexcept

前置自减

返回
自身引用

在文件 int128.hpp190 行定义.

◆ operator-=()

uint128_t & neforce::uint128_t::operator-= ( const uint128_t & other)
inlineconstexprnoexcept

减法赋值

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

在文件 int128.hpp145 行定义.

引用了 neforce::_subborrow_u64(), hi , 以及 lo.

◆ operator<<=()

uint128_t & neforce::uint128_t::operator<<= ( const uint32_t shift)
inlineconstexprnoexcept

左移赋值

参数
shift移位量
返回
自身引用

在文件 int128.hpp236 行定义.

引用了 hi , 以及 lo.

◆ operator>>=()

uint128_t & neforce::uint128_t::operator>>= ( const uint32_t shift)
inlineconstexprnoexcept

右移赋值

参数
shift移位量
返回
自身引用

在文件 int128.hpp260 行定义.

引用了 hi , 以及 lo.

◆ operator^=()

uint128_t & neforce::uint128_t::operator^= ( const uint128_t & other)
inlineconstexprnoexcept

按位异或赋值

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

在文件 int128.hpp225 行定义.

引用了 hi , 以及 lo.

◆ operator|=()

uint128_t & neforce::uint128_t::operator|= ( const uint128_t & other)
inlineconstexprnoexcept

按位或赋值

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

在文件 int128.hpp214 行定义.

引用了 hi , 以及 lo.

◆ operator~()

uint128_t neforce::uint128_t::operator~ ( ) const
inlineconstexprnoexcept

按位取反

返回
按位取反结果

在文件 int128.hpp196 行定义.

引用了 hi , 以及 lo.

◆ to_hash()

size_t neforce::uint128_t::to_hash ( ) const
inlinenodiscardconstexprnoexcept

计算哈希值

返回
哈希值

在文件 int128.hpp326 行定义.

引用了 hi , 以及 lo.


该结构体的文档由以下文件生成: