For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
SIMDSize
struct SIMDSize
Represents a type appropriate for the size of a simd vector.
Note: Typically you should use Int instead.
Implemented traits
AnyType,
Comparable,
Copyable,
Equatable,
ImplicitlyCopyable,
ImplicitlyDeletable,
Indexer,
Movable,
RegisterPassable,
TrivialRegisterPassable
Methods
__init__
@implicit
def __init__(value: IntLiteral, /) -> Self
Construct SIMDSize from the given IntLiteral value.
Args:
- value (
IntLiteral): The init value.
def __init__[T: Indexer](value: T) -> Self
Construct a SIMDSize from the given Indexer.
Parameters:
- T (
Indexer): The type of the init value.
Args:
- value (
T): The init value.
@implicit
def __init__(value: Int, /) -> Self
Construct a SIMDSize from the given Int.
Args:
- value (
Int): The init value.
__neg__
def __neg__(self) -> Self
Return -self.
Returns:
Self: The -self value.
__lt__
def __lt__(self, rhs: Self) -> Bool
Compare this SIMDSize to the RHS using LT comparison.
Args:
- rhs (
Self): The other SIMDSize to compare against.
Returns:
Bool: True if this SIMDSize is less-than the RHS SIMDSize and False otherwise.
__le__
def __le__(self, rhs: Self) -> Bool
Compare this SIMDSize to the RHS using LE comparison.
Args:
- rhs (
Self): The other SIMDSize to compare against.
Returns:
Bool: True if this SIMDSize is less-or-equal than the RHS SIMDSize and False
otherwise.
__eq__
def __eq__(self, rhs: Self) -> Bool
Compare this SIMDSize to the RHS using EQ comparison.
Args:
- rhs (
Self): The other SIMDSize to compare against.
Returns:
Bool: True if this SIMDSize is equal to the RHS SIMDSize and False otherwise.
__ne__
def __ne__(self, rhs: Self) -> Bool
Compare this Int to the RHS using NE comparison.
Args:
- rhs (
Self): The other Int to compare against.
Returns:
Bool: True if this Int is non-equal to the RHS Int and False otherwise.
__gt__
def __gt__(self, rhs: Self) -> Bool
Compare this SIMDSize to the RHS using GT comparison.
Args:
- rhs (
Self): The other SIMDSize to compare against.
Returns:
Bool: True if this SIMDSize is greater than the RHS SIMDSize and False otherwise.
__ge__
def __ge__(self, rhs: Self) -> Bool
Compare this SIMDSIze to the RHS using GE comparison.
Args:
- rhs (
Self): The other SIMDSize to compare against.
Returns:
Bool: True if this SIMDSize is greater-or-equal than the RHS SIMDSize and False
otherwise.
__add__
def __add__(self, rhs: Self) -> Self
Return self + rhs.
Args:
- rhs (
Self): The value to add.
Returns:
Self: self + rhs value.
__sub__
def __sub__(self, rhs: Self) -> Self
Return self - rhs.
Args:
- rhs (
Self): The value to subtract.
Returns:
Self: self - rhs value.
__mul__
def __mul__(self, rhs: Self) -> Self
Return self * rhs.
Args:
- rhs (
Self): The value to multiply with.
Returns:
Self: self * rhs value.
__truediv__
def __truediv__(self, rhs: Self) -> Self
Return the result of the division of self and rhs.
Performs truncating division (toward zero) for integers.
Args:
- rhs (
Self): The value to divide on.
Returns:
Self: self / rhs value.
__pow__
def __pow__(self, exp: Self) -> Self
Return the value raised to the power of the given exponent.
Computes the power of an integer using the Russian Peasant Method.
Args:
- exp (
Self): The exponent value.
Returns:
Self: The value of self raised to the power of exp.
__rshift__
def __rshift__(self, rhs: Self) -> Self
Return self >> rhs.
Args:
- rhs (
Self): The value to shift with.
Returns:
Self: self >> rhs.
__and__
def __and__(self, rhs: Self) -> Self
Return self & rhs.
Args:
- rhs (
Self): The RHS value.
Returns:
Self: self & rhs.
__imul__
def __imul__(mut self, rhs: Self)
Compute self*rhs and save the result in self.
Args:
- rhs (
Self): The RHS value.
__irshift__
def __irshift__(mut self, rhs: Self)
Compute self >> rhs and save the result in self.
Args:
- rhs (
Self): The RHS value.
__mlir_index__
def __mlir_index__(self) -> __mlir_type.index
Convert to index.
Returns:
__mlir_type.index: The corresponding __mlir_type.index value.
is_power_of_two
def is_power_of_two(self) -> Bool
Check if the integer is a (non-zero) power of two.
Returns:
Bool: True if the integer is a power of two, False otherwise.