Skip to content

#[repr(simd)] on structs vs arrays, motivation #37

Closed
@gnzlbg

Description

@gnzlbg

I have been trying to find the motivation for using repr(simd) on tuple structs instead of arrays for a while without any luck. Does anybody have some pointers?

I must be missing something because to make using it on arrays makes much more sense, mainly because:

  • we can use the recently merged type-level const RFC to create arbitrary sized simd vectors on stable (maybe preventing this was the aim of using tuple structs? if so, tuple structs will also fail here if we ever get variadics)
  • we can use [] to index into the elements of a simd vector, which is much nicer than using .0 (maybe it is because [] always does bounds checking which would be bad for simd where a compile-time solution would be preferable?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions