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
minminimum value
maxmaximum value
Methods
size_t toHash() @safe pure nothrow @nogc constReturns: hash value for Int128
bool opEquals(long lo) @safe pure nothrow @nogc constCompare for equality Params: lo = signed value to compare with Returns: true if Int128 equals value
bool opEquals(ulong lo) @safe pure nothrow @nogc constCompare for equality Params: lo = unsigned value to compare with Returns: true if Int128 equals value
bool opEquals(Int128 op2) @safe pure nothrow @nogc constCompare for equality Params: op2 = value to compare with Returns: true if Int128 equals value
Int128 opUnary(string op)() if (op == "+") @safe pure nothrow @nogc constSupport unary arithmentic operator + Params: op = "+" Returns: lvalue of result
Int128 opUnary(string op)() if (op == "-" || op == "~") @safe pure nothrow @nogc constSupport unary arithmentic operator - ~ Params: op = "-", "~" Returns: lvalue of result
Int128 opUnary(string op)() if (op == "++" || op == "--") @safe pure nothrow @nogcSupport unary arithmentic operator ++ -- Params: op = "++", "--" Returns: lvalue of result
bool opCast(T : bool)() @safe pure nothrow @nogc 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`).
Constructors
this(long lo)Construct an `Int128` from a `long` value. The upper 64 bits are formed by sign extension. Params: lo = signed lower 64 bits
this(ulong lo)Construct an `Int128` from a `ulong` value. The upper 64 bits are set to zero. Params: lo = unsigned lower 64 bits
this(long hi, long lo)Construct an `Int128` from a `long` value. Params: hi = upper 64 bits lo = lower 64 bits
this(Cent data)Construct an `Int128` from a `Cent`. Params: data = Cent data