std.int128

Implements a signed 128 bit integer type.

Author: Walter Bright

struct Int128

Types 1

structInt128

128 bit signed integer type.

Fields
Cent data
Int128(long.min, 0) minminimum value
Int128(long.max, ulong.max) maxmaximum value
Methods
size_t toHash() constReturns: hash value for Int128
bool opEquals(long lo) constCompare for equality Params: lo = signed value to compare with Returns: true if Int128 equals value
bool opEquals(ulong lo) constCompare for equality Params: lo = unsigned value to compare with Returns: true if Int128 equals value
bool opEquals(Int128 op2) constCompare for equality Params: op2 = value to compare with Returns: true if Int128 equals value
Int128 opUnary(string op)() if (op == "+") constSupport unary arithmentic operator + Params: op = "+" Returns: lvalue of result
Int128 opUnary(string op)() if (op == "-" || op == "~") constSupport unary arithmentic operator - ~ Params: op = "-", "~" Returns: lvalue of result
Int128 opUnary(string op)() if (op == "++" || op == "--")Support unary arithmentic operator ++ -- Params: op = "++", "--" Returns: lvalue of result
bool opCast(T : bool)() constSupport casting to a bool Params: T = bool Returns: true if value is not zero
T opCast(T : long)() if (is(byte : T)) constSupport casting to an integral type Params: T = integral type Returns: low bits of value reinterpreted as T
T opCast(T : real)() constSupport casting to floating point type Params: T = floating point type Returns: value cast to floating point with environment-dependent rounding if the value is not exactly representable
Int128 opBinary(string op)(Int128 op2) if (op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^") constSupport binary arithmetic operators + - * / % & | ^ << >> >>> Params: op = one of the arithmetic binary operators op2 = second operand Returns: value after the operation is applied
Int128 opBinary(string op, Int)(const Int op2) if ((op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^") && is(Int : long) && __traits(isIntegral, Int)) constditto
Int128 opBinary(string op, IntLike)(auto ref IntLike op2) if ((op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^") && is(IntLike : long) && !__traits(isIntegral, IntLike)) constditto
Int128 opBinaryRight(string op, Int)(const Int op2) if ((op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^") && is(Int : long) && __traits(isIntegral, Int)) constditto
Int128 opBinaryRight(string op, IntLike)(auto ref IntLike op2) if ((op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^") && is(IntLike : long) && !__traits(isIntegral, IntLike)) constditto
Int128 opBinary(string op)(long op2) if (op == "<<") constditto
Int128 opBinary(string op)(long op2) if (op == ">>") constditto
Int128 opBinary(string op)(long op2) if (op == ">>>") constditto
Int128 opOpAssign(string op)(Int128 op2) if (op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^" || op == "<<" || op == ">>" || op == ">>>") refarithmetic assignment operators += -= *= /= %= &= |= ^= <<= >>= >>>= Params: op = one of +, -, etc. op2 = second operand Returns: lvalue of updated left operand
Int128 opOpAssign(string op, Int)(auto ref Int op2) if ((op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^" || op == "<<" || op == ">>" || op == ">>>") && is(Int : long)) refditto
int opCmp(Int128 op2) const @nogc nothrow pure @safesupport arithmentic comparison operators < <= > >= Params: op2 = right hand operand Returns: -1 for less than, 0 for equals, 1 for greater than
int opCmp(Int)(const Int op2) if (is(Int : long) && __traits(isIntegral, Int)) const @nogc nothrow pure @safeditto
int opCmp(IntLike)(auto ref IntLike op2) if (is(IntLike : long) && !__traits(isIntegral, IntLike)) constditto
void toString(Writer, FormatSpec)(scope ref Writer sink, scope const ref FormatSpec fmt) constFormats `Int128` with either `%d`, `%x`, `%X`, or `%s` (same as `%d`).