Mojo struct
SMemArrayType
@register_passable(trivial)
struct SMemArrayType[type: AnyTrivialRegType, size: Int]
Shared memory array of fixed size.
Parameters
- type (
AnyTrivialRegType): Element type. - size (
Int): Number of elements.
Fields
- ptr (
LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]):
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 = LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]
storage_size
alias storage_size = (size * size_of[type]())
Methods
__init__
__init__(unsafe_ptr: LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]) -> Self
Initialize with shared memory pointer.
Args:
- unsafe_ptr (
LegacyUnsafePointer): Shared memory pointer.
__getitem__
__getitem__[T: Intable](self, index: T) -> LegacyUnsafePointer[type, address_space=AddressSpace.SHARED]
Get a pointer to the element at index.
Args:
- index (
T): Element index.
Returns:
LegacyUnsafePointer: 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!