The OpenD Programming Language

BigInt.this

Construct a BigInt from a sign and a magnitude.

The magnitude is an input range of unsigned integers that satisfies either std.range.primitives.hasLength or std.range.primitives.isForwardRange. The first (leftmost) element of the magnitude is considered the most significant.

  1. this(Range s)
  2. this(Range s)
  3. this(bool isNegative, Range magnitude)
    struct BigInt
    this
    (
    Range
    )
    (,
    Range magnitude
    )
    if (
    isInputRange!Range &&
    &&
    (
    hasLength!Range ||
    )
    &&
    !isInfinite!Range
    )
  4. this(T x)
  5. this(T x)

Parameters

isNegative bool

true for negative, false for non-negative (ignored when magnitude is zero)

magnitude Range

a finite range of unsigned integers

Examples

ubyte[] magnitude = [1, 2, 3, 4, 5, 6];
auto b1 = BigInt(false, magnitude);
assert(cast(long) b1 == 0x01_02_03_04_05_06L);
auto b2 = BigInt(true, magnitude);
assert(cast(long) b2 == -0x01_02_03_04_05_06L);

Meta