Skip to content

Flavorful return types like "uint8x16x2_t" #316

Open
@alexcrichton

Description

@alexcrichton

Some intrinsics on NEON like vtrnq_u8 have a nonstandard return type like uint8x16x2_t defined as:

typedef struct uint8x16x2_t {
  uint8x16_t val[2];
} uint8x16x2_t;

How should we best represent this in Rust? A few possible options are:

  1. unsafe fn vtrnq_u8(a: uint8x16_t, b: uint8x16_t) -> uint8x16x2_t; - aka we define the struct w/ pub fields in Rust like with the libc crate
  2. unsafe fn vtrnq_u8(a: uint8x16_t, b: uint8x16_t) -> [uint8x16_t; 2]
  3. unsafe fn vtrnq_u8(a: uint8x16_t, b: uint8x16_t) -> (uint8x16_t; uint8x16_6)

I'd sort of lean towards the last one, but it also depends on how "flavorful" the return types get!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions