#Is there a cost to converting from []u8 to Vector?
1 messages · Page 1 of 1 (latest)
arrays and vectors coerce into each other ([n]T <-> @Vector(n, T)).
you can reslice your slice with comptime-known bounds to get a pointer to an array, dereference that, and coerce
there shouldn't be much overhead, I don't think, since the whole conversion amounts into an unaligned load into a SIMD register - you can go to Compiler Explorer to see the generated assembly, and make sure to run performance tests, if you're worried about that