Skip to main content

Mojo struct

SMemArrayType

@register_passable(trivial) struct SMemArrayType[type: AnyType, size: Int]

Shared memory array of fixed size.

Parameters

  • type (AnyType): Element type.
  • size (Int): Number of elements.

Fields

  • ptr (UnsafePointer[type, address_space=AddressSpace(3)]):

Implemented traits

AnyType, Copyable, ImplicitlyCopyable, Movable, UnknownDestructibility

Aliases

__copyinit__is_trivial

alias __copyinit__is_trivial = True

__del__is_trivial

alias __del__is_trivial = True

__moveinit__is_trivial

alias __moveinit__is_trivial = True

ptr_type

alias ptr_type = UnsafePointer[type, address_space=AddressSpace(3)]

storage_size

alias storage_size = (size * size_of[type]())

Methods

__init__

__init__(unsafe_ptr: UnsafePointer[type, address_space=AddressSpace(3)]) -> Self

Initialize with shared memory pointer.

Args:

__getitem__

__getitem__[T: Intable](self, index: T) -> UnsafePointer[type, address_space=AddressSpace(3)]

Get element at index.

Args:

  • index (T): Element index.

Returns:

UnsafePointer: Pointer to element.

len

static len() -> Int

Get array length in bytes.

Returns:

Int: Total size in bytes.

Was this page helpful?