mikegarts
mikegarts
MModular
Created by mikegarts on 11/27/2023 in #questions
Casting between DTypePointer[DType.uint8] and Pointer[UInt8] ?
Hi @Alex Kirchhoff and thanks again. I indeed tried different ways to cast my way out, including the one you mentioned but sadly it yields in error too 🙂 error: no matching function in call to 'bitcast' with a list of bitcast variants (according to the latest docs). I guess I'll have to wait a little for the new release 🙂
5 replies
MModular
Created by mikegarts on 11/27/2023 in #questions
Casting between DTypePointer[DType.uint8] and Pointer[UInt8] ?
Hi @Alex Kirchhoff and thanks for the reply! I saw the .address field but couldn't make it work. For example:
var ptrd = DTypePointer[DType.uint8].alloc(10)
var ptrany : Pointer[UInt8]
ptrany = ptrd.address
var ptrd = DTypePointer[DType.uint8].alloc(10)
var ptrany : Pointer[UInt8]
ptrany = ptrd.address
yields error: cannot implicitly convert 'pointer<scalar<ui8>>' value to 'Pointer[SIMD[ui8, 1]]' in assignment I think that I'm missing something here, since the two types are quite similar (both point to a memory with UInt8). Trying to __init__ Pointer[UInt8] fails as well: ptrany = Pointer[UInt8](ptrd.address) yields: error: cannot construct 'Pointer[SIMD[ui8, 1]]' from 'pointer<scalar<ui8>>' value in assignment
5 replies