Sha256: f040611995bcd1bd2cb47694e74aa02ff4fabdffe007f712c9bb788d82dfb8a7

Contents?: true

Size: 948 Bytes

Versions: 38

Compression:

Stored size: 948 Bytes

Contents

use minimal_lexical::bigint;
#[cfg(feature = "alloc")]
pub use minimal_lexical::heapvec::HeapVec as VecType;
#[cfg(not(feature = "alloc"))]
pub use minimal_lexical::stackvec::StackVec as VecType;

pub fn vec_from_u32(x: &[u32]) -> VecType {
    let mut vec = VecType::new();
    #[cfg(not(all(target_pointer_width = "64", not(target_arch = "sparc"))))]
    {
        for &xi in x {
            vec.try_push(xi as bigint::Limb).unwrap();
        }
    }

    #[cfg(all(target_pointer_width = "64", not(target_arch = "sparc")))]
    {
        for xi in x.chunks(2) {
            match xi.len() {
                1 => vec.try_push(xi[0] as bigint::Limb).unwrap(),
                2 => {
                    let xi0 = xi[0] as bigint::Limb;
                    let xi1 = xi[1] as bigint::Limb;
                    vec.try_push((xi1 << 32) | xi0).unwrap()
                },
                _ => unreachable!(),
            }
        }
    }

    vec
}

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-28.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-27.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-26.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-25.0.2 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-25.0.1 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-25.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-24.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-23.0.2 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-22.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-21.0.1 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-20.0.2 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-20.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-18.0.3 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-17.0.1 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-17.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-16.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-15.0.1 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-15.0.0 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs
wasmtime-14.0.4 ./ext/cargo-vendor/minimal-lexical-0.2.1/tests/stackvec.rs