Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Downloads
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Calendar
  - Forums
  - IRC
  - Community Discord
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Contributors
  - Foundation
  - Security Team
  - Donate
  - Sponsors
- Resources
  - Tour
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - run.dlang.io
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# std.int128

Implements a signed 128 bit integer type.

Author Walter Bright

License:
Boost License 1.0

Source std/int128.d

struct `Int128`;
  128 bit signed integer type.
  Cent `data`;
    core.int128.Cent
  pure nothrow @nogc @safe this(long `lo`);
    Construct an Int128 from a long value. The upper 64 bits are formed by sign extension.
    Parameters:

    long `lo` | signed lower 64 bits

  pure nothrow @nogc @safe this(ulong `lo`);
    Construct an Int128 from a ulong value. The upper 64 bits are set to zero.
    Parameters:

    ulong `lo` | unsigned lower 64 bits

  pure nothrow @nogc @safe this(long `hi`, long `lo`);
    Construct an Int128 from a long value.
    Parameters:

    long `hi` | upper 64 bits
    long `lo` | lower 64 bits

  pure nothrow @nogc @safe this(Cent `data`);
    Construct an Int128 from a Cent.
    Parameters:

    Cent `data` | Cent data

  const pure nothrow @nogc @safe size_t `toHash`();
    Returns:
    hash value for Int128
  const pure nothrow @nogc @safe bool `opEquals`(long `lo`);
    Compare for equality
    Parameters:

    long `lo` | signed value to compare with

    Returns:
    true if Int128 equals value
  const pure nothrow @nogc @safe bool `opEquals`(ulong `lo`);
    Compare for equality
    Parameters:

    ulong `lo` | unsigned value to compare with

    Returns:
    true if Int128 equals value
  const pure nothrow @nogc @safe bool `opEquals`(Int128 `op2`);
    Compare for equality
    Parameters:

    Int128 `op2` | value to compare with

    Returns:
    true if Int128 equals value
  const Int128 `opUnary`(string op)()
  if (op == "+");
    Support unary arithmentic operator +
    Parameters:

    op | "+"

    Returns:
    lvalue of result
  const Int128 `opUnary`(string op)()
  if (op == "-" || op == "~");
    Support unary arithmentic operator - ~
    Parameters:

    op | "-", "~"

    Returns:
    lvalue of result
  Int128 `opUnary`(string op)()
  if (op == "++" || op == "--");
    Support unary arithmentic operator ++ --
    Parameters:

    op | "++", "--"

    Returns:
    lvalue of result
  const bool `opCast`(T : bool)();
    Support casting to a bool
    Parameters:

    T | bool

    Returns:
    boolean result
  const Int128 `opBinary`(string op)(Int128 `op2`)
  if (op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^");
  const Int128 `opBinary`(string op)(long `op2`)
  if (op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^");
  const Int128 `opBinaryRight`(string op)(long `op2`)
  if (op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^");
  const Int128 `opBinary`(string op)(long `op2`)
  if (op == "<<");
  const Int128 `opBinary`(string op)(long `op2`)
  if (op == ">>");
  const Int128 `opBinary`(string op)(long `op2`)
  if (op == ">>>");
    Support binary arithmetic operators + - * / % & | ^ << >> >>>
    Parameters:

    op | one of the arithmetic binary operators
    Int128 `op2` | second operand

    Returns:
    value after the operation is applied
  ref Int128 `opOpAssign`(string op)(Int128 `op2`)
  if (op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^" || op == "<<" || op == ">>" || op == ">>>");
  ref Int128 `opOpAssign`(string op)(long `op2`)
  if (op == "+" || op == "-" || op == "*" || op == "/" || op == "%" || op == "&" || op == "|" || op == "^" || op == "<<" || op == ">>" || op == ">>>");
    arithmetic assignment operators += -= *= /= %= &= |= ^= <<= >>= >>>=
    Parameters:

    op | one of +, -, etc.
    Int128 `op2` | second operand

    Returns:
    lvalue of updated left operand
  const pure nothrow @nogc @safe int `opCmp`(Int128 `op2`);
    support signed arithmentic comparison operators < <= > >=
    Parameters:

    Int128 `op2` | right hand operand

    Returns:
    -1 for less than, 0 for equals, 1 for greater than
  const pure nothrow @nogc @safe int `opCmp`(long `op2`);
    support signed arithmentic comparison operators < <= > >=
    Parameters:

    long `op2` | right hand operand

    Returns:
    -1 for less than, 0 for equals, 1 for greater than
  enum Int128 `min`;
    minimum value
  enum Int128 `max`;
    maximum value

Copyright © 1999-2022 by the D Language Foundation | Page generated by Ddoc on Mon Nov 14 18:07:23 2022