Skip to content

128-bit array memset fill #594

@brody2consult

Description

@brody2consult

what - examples

pub fn init_zero_array_u128() -> [u128; 4] {
    return [0; 4];
}

or for signed (i128) array:

pub fn init_zero_array_i128() -> [i128; 4] {
    return [0; 4];
}

why

As an experiment I have been able to build a "shader" that imports & uses chacha20 from RustCrypto, with many (many) local workarounds that I would like to discuss in the near future. The first build issue that I encountered was this:

   Compiling cipher v0.5.1
error: memset on integer width 128 not implemented yet
   --> /Users/brody-dev/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/crypto-common-0.2.1/src/hazmat.rs:347:1
    |
347 | / impl_serializable_state_u128_array! {
348 | |     U1,
349 | |     U2,
350 | |     U3,
...   |
362 | |     U512
363 | | }
    | |_^

While it would be possible for me to continue building by removing or feature-gating the impl_serializable_state_u128! usage in crypto-common, I think it would be much easier if I could continue building without this kind of hackage.

While I would love to see this resolved for both signed & unsigned 128-bit arrays, the unsigned case is more important for me at this point.

related issues

potential workaround

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions