The OpenD Programming Language

UInt.opBinary

auto c = a << b operation.

  1. UInt!size opBinary(size_t rhs)
    struct UInt(size_t size)
    const @safe pure nothrow @nogc
    UInt!size
    opBinary
    (
    string op
    )
    (
    size_t rhs
    )
    if (
    op == "<<" ||
    op == ">>>"
    ||
    op == ">>"
    )
    if (
    size % (size_t.sizeof * 8) == 0 &&
    size >= size_t.sizeof * 8
    )
  2. template opBinary(string op)

Examples

auto a = UInt!128.fromHexString("afbbfae3cd0aff2714a1de7022b0029d");
assert(a << 0 == a);
assert(a << 4 == UInt!128.fromHexString("fbbfae3cd0aff2714a1de7022b0029d0"));
assert(a << 68 == UInt!128.fromHexString("4a1de7022b0029d00000000000000000"));
assert(a << 127 == UInt!128.fromHexString("80000000000000000000000000000000"));
assert(a >> 0 == a);
assert(a >> 4 == UInt!128.fromHexString("afbbfae3cd0aff2714a1de7022b0029"));
assert(a >> 68 == UInt!128.fromHexString("afbbfae3cd0aff2"));
assert(a >> 127 == UInt!128(1));

Meta