Mojo struct
IntLiteral
@register_passable(trivial)
struct IntLiteral
This type represents a static integer literal value with infinite precision. They can't be materialized at runtime and must be lowered to other integer types (like Int), but allow for compile-time operations that would overflow on Int and other fixed precision integer types.
Fields
- value (
!kgen.int_literal
): The underlying storage for the integer value.
Implemented traits
Absable
,
AnyType
,
Boolable
,
CeilDivable
,
Ceilable
,
CollectionElement
,
Comparable
,
Copyable
,
EqualityComparable
,
Floorable
,
ImplicitlyBoolable
,
Indexer
,
Intable
,
Movable
,
Roundable
,
Stringable
,
Truncable
,
UnknownDestructibility
Methods
__init__
__init__(out self)
Default constructor.
__bool__
__bool__(self) -> Bool
Convert this IntLiteral to Bool.
Returns:
False Bool value if the value is equal to 0 and True otherwise.
__neg__
__neg__(self) -> Self
Return -self.
Returns:
The -self value.
__pos__
__pos__(self) -> Self
Return +self.
Returns:
The +self value.
__invert__
__invert__(self) -> Self
Return ~self.
Returns:
The ~self value.
__lt__
__lt__(self, rhs: Self) -> Bool
Compare this IntLiteral to the RHS using LT comparison.
Args:
- rhs (
Self
): The other IntLiteral to compare against.
Returns:
True if this IntLiteral is less-than the RHS IntLiteral and False otherwise.
__le__
__le__(self, rhs: Self) -> Bool
Compare this IntLiteral to the RHS using LE comparison.
Args:
- rhs (
Self
): The other IntLiteral to compare against.
Returns:
True if this IntLiteral is less-or-equal than the RHS IntLiteral and False otherwise.
__eq__
__eq__(self, rhs: Self) -> Bool
Compare this IntLiteral to the RHS using EQ comparison.
Args:
- rhs (
Self
): The other IntLiteral to compare against.
Returns:
True if this IntLiteral is equal to the RHS IntLiteral and False otherwise.
__ne__
__ne__(self, rhs: Self) -> Bool
Compare this IntLiteral to the RHS using NE comparison.
Args:
- rhs (
Self
): The other IntLiteral to compare against.
Returns:
True if this IntLiteral is non-equal to the RHS IntLiteral and False otherwise.
__gt__
__gt__(self, rhs: Self) -> Bool
Compare this IntLiteral to the RHS using GT comparison.
Args:
- rhs (
Self
): The other IntLiteral to compare against.
Returns:
True if this IntLiteral is greater-than the RHS IntLiteral and False otherwise.
__ge__
__ge__(self, rhs: Self) -> Bool
Compare this IntLiteral to the RHS using GE comparison.
Args:
- rhs (
Self
): The other IntLiteral to compare against.
Returns:
True if this IntLiteral is greater-or-equal than the RHS IntLiteral and False otherwise.