DTypePointer to StaticTuple array
Suppose I have defined a static tuple
x
as follows: var x = StaticTuple[4, Float32](1.0, 2.0, 3.0, 4.0)
. Is it possible to create an instance of DTypePointer[DType.float32]
from the address of x
's underlying storage?5 Replies
Congrats @Leandro, you just advanced to level 2!
I was wondering the same a couple of times. In fast base64 repo I ended up having an alias calling a function which defines a SIMD vector, allocates a DTypePointer of appropriate size and simd stores the values from simd vector into the pointer. I wonder if there is a better way though. E.g. static tuple or list literal…
Code I just described https://github.com/mzaks/mojo-fast-base64/blob/934b8ffa5fcaa70e78a7c5ba328ed17a68a222b7/fast_base64/chromium.mojo#L12
GitHub
mojo-fast-base64/fast_base64/chromium.mojo at 934b8ffa5fcaa70e78a7c...
Contribute to mzaks/mojo-fast-base64 development by creating an account on GitHub.
Hi, @Jack Clayton. Can you help me with this question?
Now
StaticTuple
has the method as_ptr
❤️Awesome! Sorry must have missed this