#Do vectors have a guaranteed layout or alignment?
1 messages · Page 1 of 1 (latest)
You can also find out yourself via @bitCast.
Note, that float precision varies depending on SIMD instructions and implementation.
float operations precision*
Zig is designed to be portable, so it would be a bug if not.
zig will generate the necessary code to convert between them if they are not identical
you can't assume bit equality for most things, because zig doesn't guarantee bit equality for most things
"It's a compile error to bitcast a value of undefined layout; this means that, besides the restriction from types which possess dedicated casting builtins (enums, pointers, error sets), bare structs, error unions, slices, optionals, and any other type without a well-defined memory layout, also cannot be used in this operation. "
SIMD has undefined layout.
Nah, more no well-defined layout.
what? SIMD's layout is defined by the architecture
its very well defined, its just not defined under zig's purview
yes, so what I'm trying to say is that one can use @bitCast to find out.
"any other type without a well-defined memory layout", SIMD has a well defined memory layout, so it will always be allowed https://github.com/ziglang/zig/blob/master/src/type.zig#L2637