Skip to content

uint: 32-bit limbs are not supported properly #929

@nazar-pc

Description

@nazar-pc
construct_uint! {
    pub struct U64(2);
}

This piece of code generates some code that makes sense, like this:

    ///   Conversion to u32
    #[inline]
    pub const fn low_u32(&self) -> u32 {
        let &U64(ref arr) = self;
        arr[0] as u32
    }

But mostly non-sensical like this:

pub struct U64(pub [u64; 2]);

It'd be nice if it recognized that 64/2 == 32 and generated [u32; 2] instead.

The use case is SPIR-V target, which is technically 64-bit, but requires special capability in practice, which is not supported by some GPUs, so I need u64 that is a [u32; 2] and u128 that is [u32; 4].

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