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

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

#include <int128.hpp>

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

Public 成员函数

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

静态 Public 成员函数

static constexpr int128_t min () noexcept
 获取最小值
static constexpr int128_t max () noexcept
 获取最大值

Public 属性

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

详细描述

128位有符号整数类型

在文件 int128.hpp388 行定义.

构造及析构函数说明

◆ int128_t() [1/6]

neforce::int128_t::int128_t ( const long value)
inlineconstexprnoexcept

从 long 构造

参数
value整数值

在文件 int128.hpp399 行定义.

◆ int128_t() [2/6]

neforce::int128_t::int128_t ( const int32_t value)
inlineconstexprnoexcept

从32位有符号整数构造

参数
value整数值

在文件 int128.hpp406 行定义.

◆ int128_t() [3/6]

neforce::int128_t::int128_t ( const long long value)
inlineconstexprnoexcept

从 long long 构造

参数
value整数值

在文件 int128.hpp413 行定义.

引用了 hi , 以及 lo.

◆ int128_t() [4/6]

neforce::int128_t::int128_t ( const uint64_t low,
const bool negative = false )
inlineconstexprnoexcept

从低64位和符号构造

参数
low低64位
negative是否为负数

在文件 int128.hpp422 行定义.

引用了 hi , 以及 lo.

◆ int128_t() [5/6]

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

从高低64位构造

参数
high高64位
low低64位

在文件 int128.hpp431 行定义.

引用了 hi , 以及 lo.

◆ int128_t() [6/6]

neforce::int128_t::int128_t ( const uint128_t & other)
inlineconstexprnoexcept

从无符号128位整数构造/赋值

参数
other无符号128位整数

在文件 int128.hpp444 行定义.

引用了 hi , 以及 lo.

成员函数说明

◆ equal_to()

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

相等比较

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

在文件 int128.hpp488 行定义.

引用了 hi , 以及 lo.

◆ is_negative()

bool neforce::int128_t::is_negative ( ) const
inlinenodiscardconstexprnoexcept

检查是否为负数

返回
是否为负数

在文件 int128.hpp475 行定义.

引用了 hi.

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

◆ less_than()

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

小于比较(考虑符号)

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

在文件 int128.hpp497 行定义.

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

◆ max()

constexpr int128_t neforce::int128_t::max ( )
inlinestaticconstexprnoexcept

获取最大值

返回
最大值

在文件 int128.hpp682 行定义.

◆ min()

constexpr int128_t neforce::int128_t::min ( )
inlinestaticconstexprnoexcept

获取最小值

返回
最小值

在文件 int128.hpp674 行定义.

◆ negation()

int128_t neforce::int128_t::negation ( ) const
inlinenodiscardconstexprnoexcept

负号

返回
取负结果

在文件 int128.hpp510 行定义.

引用了 hi , 以及 lo.

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

◆ operator&=()

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

按位与赋值

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

在文件 int128.hpp597 行定义.

引用了 hi , 以及 lo.

◆ operator*=()

int128_t & neforce::int128_t::operator*= ( const int128_t & other)
inlineconstexprnoexcept

乘法赋值

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

在文件 int128.hpp549 行定义.

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

◆ operator++()

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

前置自增

返回
自身引用

在文件 int128.hpp578 行定义.

◆ operator+=()

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

加法赋值

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

在文件 int128.hpp521 行定义.

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

◆ operator--()

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

前置自减

返回
自身引用

在文件 int128.hpp584 行定义.

◆ operator-=()

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

减法赋值

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

在文件 int128.hpp535 行定义.

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

◆ operator<<=()

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

左移赋值

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

在文件 int128.hpp630 行定义.

引用了 to_uint128().

◆ operator=()

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

从无符号128位整数赋值

参数
other无符号128位整数
返回
自身引用

在文件 int128.hpp453 行定义.

引用了 hi , 以及 lo.

◆ operator>>=()

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

右移赋值(算术右移)

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

在文件 int128.hpp640 行定义.

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

◆ operator^=()

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

按位异或赋值

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

在文件 int128.hpp619 行定义.

引用了 hi , 以及 lo.

◆ operator|=()

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

按位或赋值

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

在文件 int128.hpp608 行定义.

引用了 hi , 以及 lo.

◆ operator~()

int128_t neforce::int128_t::operator~ ( ) const
inlinenodiscardconstexprnoexcept

按位取反

返回
取反结果

在文件 int128.hpp590 行定义.

引用了 hi , 以及 lo.

◆ to_hash()

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

计算哈希值

返回
哈希值

在文件 int128.hpp663 行定义.

引用了 hi , 以及 lo.

◆ to_uint128()

uint128_t neforce::int128_t::to_uint128 ( ) const
inlinenodiscardconstexprnoexcept

转换为无符号128位整数

返回
无符号128位整数

在文件 int128.hpp481 行定义.

引用了 hi , 以及 lo.

被这些函数引用 operator%=(), operator*=(), operator+=(), operator-=(), operator/=() , 以及 operator<<=().


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