For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Mojo struct
SMemArray
struct SMemArray[type: TrivialRegisterPassable, size: Int]
Shared memory array of fixed size.
Parametersβ
- βtype (
TrivialRegisterPassable): Element type. - βsize (
Int): Number of elements.
Fieldsβ
- βptr (
SMemArray[type, size].ptr_type):
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable,
RegisterPassable,
TrivialRegisterPassable
comptime membersβ
ptr_typeβ
comptime ptr_type = UnsafePointer[type, MutAnyOrigin, address_space=AddressSpace.SHARED]
Storageβ
comptime Storage = InlineArray[type, size]
storage_sizeβ
comptime storage_size = (size * size_of[type]())
Methodsβ
__init__β
__init__(unsafe_ptr: UnsafePointer[type, MutAnyOrigin, address_space=AddressSpace.SHARED]) -> Self
Initialize with shared memory pointer.
Args:
- βunsafe_ptr (
UnsafePointer[type, MutAnyOrigin, address_space=AddressSpace.SHARED]): Shared memory pointer.
__init__(ref[AddressSpace._value] storage: InlineArray[type, size]) -> Self
Initialize from Storage.
__getitem__β
__getitem__[T: Intable](self, index: T) -> SMemArray[type, size].ptr_type
Get a pointer to the element at index.
Args:
- βindex (
T): Element index.
Returns:
SMemArray[type, size].ptr_type: Pointer to element.
lenβ
stack_allocationβ
static stack_allocation[alignment: Int = align_of[type]()]() -> Self
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!