Fp.opBinary

Performs binary operations like multiplication on two Fp numbers of possibly different sizes, returning an Fp with size equal to the maximum.

  1. Fp!(max(size, rhsSize)) opBinary(Fp!rhsSize rhs)
    struct Fp(uint size)
    nothrow const
    Fp!(max(size, rhsSize))
    opBinary
    (
    string op : "*"
    uint rhsSize
    )
    (
    Fp!rhsSize rhs
    )
    if (
    size % (uint.sizeof * 8) == 0 &&
    size >= (uint.sizeof * 8)
    )
  2. Fp!(max(size, rhsSize)) opBinary(Fp!rhsSize rhs)

Examples

import mir.bignum.fixed: UInt;

auto a = Fp!128(0, -13, UInt!128.fromHexString("dfbbfae3cd0aff2714a1de7022b0029d"));
auto b = Fp!128(1, 100, UInt!128.fromHexString("e3251bacb112c88b71ad3f85a970a314"));
auto fp = a.opBinary!"*"(b);
assert(fp.sign);
assert(fp.exponent == 100 - 13 + 128);
assert(fp.coefficient == UInt!128.fromHexString("c6841dd302415d785373ab6d93712988"));