You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to load string to Vector256 so I initially wrote
lets="Hi, what's your name?"letspan= s.AsSpan()letr=&MemoryMarshal.GetReference(span)letv= Vector256.LoadUnsafe<uint16>(Unsafe.As(&r))// <== & should precede Unsafe.As.
It throws System.NullReferenceException. Then I realized that & is missing before Unsafe.As. But now I'm wondering why it even compiles (it seems I'm giving uint16 where byref<uint16> is expected)?
Following doesn't compile as expected:
letr2:byref<uint16>=&Unsafe.As(&r)letv2= Vector256.LoadUnsafe<uint16>(r2)// <== Doesn't compile (& should precede r2).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
I wanted to load string to
Vector256so I initially wroteIt throws
System.NullReferenceException. Then I realized that&is missing beforeUnsafe.As. But now I'm wondering why it even compiles (it seems I'm givinguint16wherebyref<uint16>is expected)?Following doesn't compile as expected:
All reactions