#Do vectors have a guaranteed layout or alignment?

1 messages · Page 1 of 1 (latest)

icy fern
#

I dunno about guaranteed layout or anything, but I'm fairly certain that all instances of @Vector(4, f32) would be treated as identical types.

drowsy monolith
#

no

#

the layout of vectors is defined by the architecture

dry cairn
#

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.

drowsy monolith
#

you can't assume bit equality for most things, because zig doesn't guarantee bit equality for most things

dry cairn
#

Nah, more no well-defined layout.

drowsy monolith
#

what? SIMD's layout is defined by the architecture

#

its very well defined, its just not defined under zig's purview

dry cairn
#

yes, so what I'm trying to say is that one can use @bitCast to find out.

drowsy monolith