1cbd624adSopenharmony_ciuse minimal_lexical::bigint;
2cbd624adSopenharmony_ci#[cfg(feature = "alloc")]
3cbd624adSopenharmony_cipub use minimal_lexical::heapvec::HeapVec as VecType;
4cbd624adSopenharmony_ci#[cfg(not(feature = "alloc"))]
5cbd624adSopenharmony_cipub use minimal_lexical::stackvec::StackVec as VecType;
6cbd624adSopenharmony_ci
7cbd624adSopenharmony_cipub fn vec_from_u32(x: &[u32]) -> VecType {
8cbd624adSopenharmony_ci    let mut vec = VecType::new();
9cbd624adSopenharmony_ci    #[cfg(not(all(target_pointer_width = "64", not(target_arch = "sparc"))))]
10cbd624adSopenharmony_ci    {
11cbd624adSopenharmony_ci        for &xi in x {
12cbd624adSopenharmony_ci            vec.try_push(xi as bigint::Limb).unwrap();
13cbd624adSopenharmony_ci        }
14cbd624adSopenharmony_ci    }
15cbd624adSopenharmony_ci
16cbd624adSopenharmony_ci    #[cfg(all(target_pointer_width = "64", not(target_arch = "sparc")))]
17cbd624adSopenharmony_ci    {
18cbd624adSopenharmony_ci        for xi in x.chunks(2) {
19cbd624adSopenharmony_ci            match xi.len() {
20cbd624adSopenharmony_ci                1 => vec.try_push(xi[0] as bigint::Limb).unwrap(),
21cbd624adSopenharmony_ci                2 => {
22cbd624adSopenharmony_ci                    let xi0 = xi[0] as bigint::Limb;
23cbd624adSopenharmony_ci                    let xi1 = xi[1] as bigint::Limb;
24cbd624adSopenharmony_ci                    vec.try_push((xi1 << 32) | xi0).unwrap()
25cbd624adSopenharmony_ci                },
26cbd624adSopenharmony_ci                _ => unreachable!(),
27cbd624adSopenharmony_ci            }
28cbd624adSopenharmony_ci        }
29cbd624adSopenharmony_ci    }
30cbd624adSopenharmony_ci
31cbd624adSopenharmony_ci    vec
32cbd624adSopenharmony_ci}
33