int

object int
Source:
int.scala
class Object
trait Matchable
class Any
int.type

Type members

Types

type %[X <: Int, Y <: Int] <: Int

Remainder of the division of X by Y.

Remainder of the division of X by Y.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val mod: 5 % 2 = 1
}
Source:
int.scala
type *[X <: Int, Y <: Int] <: Int

Multiplication of two Int singleton types.

Multiplication of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val mul: 4 * 2 = 8
}
Source:
int.scala
type +[X <: Int, Y <: Int] <: Int

Addition of two Int singleton types.

Addition of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val sum: 2 + 2 = 4
}
Source:
int.scala
type -[X <: Int, Y <: Int] <: Int

Subtraction of two Int singleton types.

Subtraction of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val sub: 4 - 2 = 2
}
Source:
int.scala
type /[X <: Int, Y <: Int] <: Int

Integer division of two Int singleton types.

Integer division of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val div: 5 / 2 = 2
}
Source:
int.scala
type <[X <: Int, Y <: Int] <: Boolean

Less-than comparison of two Int singleton types.

Less-than comparison of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val lt1: 4 < 2 = false
  val lt2: 2 < 4 = true
}
Source:
int.scala
type <<[X <: Int, Y <: Int] <: Int

Binary left shift of X by Y.

Binary left shift of X by Y.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val lshift: 1 << 2 = 4
}
Source:
int.scala
type <=[X <: Int, Y <: Int] <: Boolean

Less-or-equal comparison of two Int singleton types.

Less-or-equal comparison of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val lt1: 4 <= 2 = false
  val lt2: 2 <= 2 = true
}
Source:
int.scala
type >[X <: Int, Y <: Int] <: Boolean

Greater-than comparison of two Int singleton types.

Greater-than comparison of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val gt1: 4 > 2 = true
  val gt2: 2 > 2 = false
}
Source:
int.scala
type >=[X <: Int, Y <: Int] <: Boolean

Greater-or-equal comparison of two Int singleton types.

Greater-or-equal comparison of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val ge1: 4 >= 2 = true
  val ge2: 2 >= 3 = false
}
Source:
int.scala
type >>[X <: Int, Y <: Int] <: Int

Binary right shift of X by Y.

Binary right shift of X by Y.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val rshift: 10 >> 1 = 5
}
Source:
int.scala
type >>>[X <: Int, Y <: Int] <: Int

Binary right shift of X by Y, filling the left with zeros.

Binary right shift of X by Y, filling the left with zeros.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val rshiftzero: 10 >>> 1 = 5
}
Source:
int.scala
type Abs[X <: Int] <: Int

Absolute value of an Int singleton type.

Absolute value of an Int singleton type.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val abs: Abs[-1] = 1
}
Source:
int.scala
type BitwiseAnd[X <: Int, Y <: Int] <: Int

Bitwise and of X and Y.

Bitwise and of X and Y.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val and1: BitwiseAnd[4, 4] = 4
  val and2: BitwiseAnd[10, 5] = 0
}
Source:
int.scala
type BitwiseOr[X <: Int, Y <: Int] <: Int

Bitwise or of X and Y.

Bitwise or of X and Y.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val or: BitwiseOr[10, 11] = 11
}
Source:
int.scala
type Max[X <: Int, Y <: Int] <: Int

Maximum of two Int singleton types.

Maximum of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val max: Max[-1, 1] = 1
}
Source:
int.scala
type Min[X <: Int, Y <: Int] <: Int

Minimum of two Int singleton types.

Minimum of two Int singleton types.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val min: Min[-1, 1] = -1
}
Source:
int.scala
type Negate[X <: Int] <: Int

Negation of an Int singleton type.

Negation of an Int singleton type.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val neg1: Negate[-1] = 1
  val neg2: Negate[1] = -1
}
Source:
int.scala

Number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified Int singleton type. Returns 32 if the specified singleton type has no one-bits in its two's complement representation, in other words if it is equal to zero.

Number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified Int singleton type. Returns 32 if the specified singleton type has no one-bits in its two's complement representation, in other words if it is equal to zero.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val zero_lzc: NumberOfLeadingZeros[0] = 32
  val eight_lzc: NumberOfLeadingZeros[8] = 28
  type Log2[N <: Int] = 31 - NumberOfLeadingZeros[N]
  val log2of8: Log2[8] = 3
}
Source:
int.scala
type S[N <: Int] <: Int

Successor of a natural number where zero is the type 0 and successors are reduced as if the definition was:

Successor of a natural number where zero is the type 0 and successors are reduced as if the definition was:

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  type S[N <: Int] <: Int = N match {
    case 0 => 1
    case 1 => 2
    case 2 => 3
    // ...
    case 2147483646 => 2147483647
  }
}
Source:
int.scala
type ToDouble[X <: Int] <: Double

Double conversion of an Int singleton type.

Double conversion of an Int singleton type.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val x: ToDouble[1] = 1.0
}
Source:
int.scala
type ToFloat[X <: Int] <: Float

Float conversion of an Int singleton type.

Float conversion of an Int singleton type.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val x: ToFloat[1] = 1.0f
}
Source:
int.scala
type ToLong[X <: Int] <: Long

Long conversion of an Int singleton type.

Long conversion of an Int singleton type.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val x: ToLong[1] = 1L
}
Source:
int.scala
type ToString[X <: Int] <: String

String conversion of an Int singleton type.

String conversion of an Int singleton type.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val abs: ToString[1] = "1"
}
Source:
int.scala
type ^[X <: Int, Y <: Int] <: Int

Bitwise xor of X and Y.

Bitwise xor of X and Y.

package scala.compiletime.ops
trait Snippet0 { self: int.type =>
  val xor: 10 ^ 30 = 20
}
Source:
int.scala