iyi

Prelude, 0.18.0

Int64

A 64-bit signed integer, the literal 1_i64.

In the prelude: every iyi program has it, with no import.

Int64struct

Int64iyi doc Int64
struct Int64 < Int

  def !=(other : Int32) : Bool

  def !=(other : Int64) : Bool

  def !=(other : UInt8) : Bool

  def !=(other : UInt64) : Bool

  def !=(other : Float64) : Bool

  def !=(other : UInt16) : Bool

  def %(other : Int64) : Int64

  def &(other : Int32) : self

  def &(other : Int64) : self

  def &(other : UInt8) : self

  def &(other : UInt64) : self

  def &*(other : Int32) : self

  def &*(other : Int64) : self

  def &*(other : UInt8) : self

  def &*(other : UInt64) : self

  def &+(other : Int32) : self

  def &+(other : Int64) : self

  def &+(other : UInt8) : self

  def &+(other : UInt64) : self

  def &-(other : Int32) : self

  def &-(other : Int64) : self

  def &-(other : UInt8) : self

  def &-(other : UInt64) : self

  def *(other : Int32) : self

  def *(other : Int64) : self

  def *(other : UInt8) : self

  def *(other : UInt64) : self

  def *(other : Float64) : Float64

  def +(other : Int32) : self

  def +(other : Int64) : self

  def +(other : UInt8) : self

  def +(other : UInt64) : self

  def +(other : Float64) : Float64

  def -(other : Int32) : self

  def -(other : Int64) : self

  def -(other : UInt8) : self

  def -(other : UInt64) : self

  def -(other : Float64) : Float64

  def - : Int64

  def /(other : Float64) : Float64

  def //(other : Int64) : Int64

  def <(other : Int32) : Bool

  def <(other : Int64) : Bool

  def <(other : UInt8) : Bool

  def <(other : UInt64) : Bool

  def <(other : Float64) : Bool

  def <(other : UInt16) : Bool

  def <<(count : Int32) : Int64

  def <=(other : Int32) : Bool

  def <=(other : Int64) : Bool

  def <=(other : UInt8) : Bool

  def <=(other : UInt64) : Bool

  def <=(other : Float64) : Bool

  def <=(other : UInt16) : Bool

  def ==(other : Int32) : Bool

  def ==(other : Int64) : Bool

  def ==(other : UInt8) : Bool

  def ==(other : UInt64) : Bool

  def ==(other : Float64) : Bool

  def ==(other : UInt16) : Bool

  def >(other : Int32) : Bool

  def >(other : Int64) : Bool

  def >(other : UInt8) : Bool

  def >(other : UInt64) : Bool

  def >(other : Float64) : Bool

  def >(other : UInt16) : Bool

  def >=(other : Int32) : Bool

  def >=(other : Int64) : Bool

  def >=(other : UInt8) : Bool

  def >=(other : UInt64) : Bool

  def >=(other : Float64) : Bool

  def >=(other : UInt16) : Bool

  def >>(count : Int32) : Int64

  def ^(other : Int32) : self

  def ^(other : Int64) : self

  def ^(other : UInt8) : self

  def ^(other : UInt64) : self

  def abs : Int64

  # The halves mixed, as `UInt64`'s are. Without it an `Int64` hashed to
  # its type, `Object#hash`'s default, so every key of a `Hash(Int64, V)`
  # or `Set(Int64)` went to one slot and each insert walked all the keys
  # before it: 80,000 inserts took 2.9 s and two million did not finish in
  # two minutes. `UInt64`, `UInt8`, `Char` and `Float64` were the same,
  # and `std/int`, which writes `hash` for the rest of the integer tower,
  # leaves the prelude's types to the prelude.
  def hash : Int32

  def to_f : Float64

  def to_f64 : Float64

  # The checked form raises on overflow — which in this prelude is a panic,
  # since `__crystal_raise_overflow` prints and exits (SPEC.md III.1.4).
  #
  # The unchecked form is the conversion without the check, and a float
  # past the range saturates (NaN is 0), alike in every build. It is
  # spelled the way `unsafe_chr` below is: `unsafe_to_u8`. Crystal spells
  # it `to_u8!`, which is not a name in iyi (SPEC.md III.1.7) — those
  # declarations were accepted only because a macro expansion was
  # reparsed by the other language's rules, and no iyi source could call
  # one: `x.to_u8!` is `x.to_u8` with its error propagated. The callers
  # wanted the instruction: `memset`'s `value.to_u8!` is C's "converted to
  # unsigned char", and the checked form panics on 0x1ff where C writes 0xff.
  def to_i : Int32

  def to_i32 : Int32

  def to_i64 : Int64

  # Writes digits backward using division on negative numbers so that
  # Int64::MIN (-9223372036854775808) does not overflow negation. The
  # digits are counted first and written straight into the string: they
  # went through an `Array(Int32)` of their own, an allocation and a
  # growth per number printed, and printing two million integers took
  # twice Go's time.
  def to_s(base : Int32) : String

  # Written by dividing the *negative* magnitude rather than negating it,
  # because `-Int64::MIN` is not an Int64: negation overflows and every
  # digit after it is wrong. `src/std/format.iyi` used to carry a second
  # definition of both of these with this shape, so what a program got
  # depended on whether the formatter had been loaded; there is one of each
  # now, here, where `Int32#to_s` already delegates.
  def to_s : String

  def to_u64 : UInt64

  def to_u8 : UInt8

  def unsafe_chr : Char

  def unsafe_div(other : Int32) : self

  def unsafe_div(other : Int64) : self

  def unsafe_div(other : UInt8) : self

  def unsafe_div(other : UInt64) : self

  def unsafe_mod(other : Int32) : self

  def unsafe_mod(other : Int64) : self

  def unsafe_mod(other : UInt8) : self

  def unsafe_mod(other : UInt64) : self

  def unsafe_shl(other : Int32) : self

  def unsafe_shl(other : Int64) : self

  def unsafe_shl(other : UInt8) : self

  def unsafe_shl(other : UInt64) : self

  def unsafe_shr(other : Int32) : self

  def unsafe_shr(other : Int64) : self

  def unsafe_shr(other : UInt8) : self

  def unsafe_shr(other : UInt64) : self

  def unsafe_to_f : Float64

  def unsafe_to_f64 : Float64

  def unsafe_to_i : Int32

  def unsafe_to_i32 : Int32

  def unsafe_to_i64 : Int64

  def unsafe_to_u64 : UInt64

  def unsafe_to_u8 : UInt8

  def |(other : Int32) : self

  def |(other : Int64) : self

  def |(other : UInt8) : self

  def |(other : UInt64) : self

  def self.zero : self
end