Debian Codegraph @

src/support.rs

raw symbols SCIP
1 // Copyright 2025 the Fearless_SIMD Authors
2 // SPDX-License-Identifier: Apache-2.0 OR MIT
3
4 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
5 #[repr(C, align(16))]
6 #[expect(
7 unnameable_types,
8 reason = "This is used internally, but needs to be `pub` as it's used in a sealed interface"
9 )]
10 /// Wrapper for internal native vector types that gives them 128-bit alignment.
11 pub struct Aligned128rust-analyzer cargo fearless_simd 0.4.1 support/Aligned128#<T>(pub T);
12
13 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
14 #[repr(C, align(32))]
15 #[expect(
16 unnameable_types,
17 reason = "This is used internally, but needs to be `pub` as it's used in a sealed interface"
18 )]
19 /// Wrapper for internal native vector types that gives them 256-bit alignment.
20 pub struct Aligned256rust-analyzer cargo fearless_simd 0.4.1 support/Aligned256#<T>(pub T);
21
22 #[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:)]
23 #[repr(C, align(64))]
24 #[expect(
25 unnameable_types,
26 reason = "This is used internally, but needs to be `pub` as it's used in a sealed interface"
27 )]
28 /// Wrapper for internal native vector types that gives them 512-bit alignment.
29 pub struct Aligned512rust-analyzer cargo fearless_simd 0.4.1 support/Aligned512#<T>(pub T);
30
31 /// The actual `Debug` implementation for all `SimdBase` types. This only needs to be monomorphized once per element
32 /// type, rather than once per vector type.
33 #[inline(never)]
34 pub(craterust-analyzer cargo fearless_simd 0.4.1 crate/) fn simd_debug_implrust-analyzer cargo fearless_simd 0.4.1 support/simd_debug_impl().<Element: corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#>(
35 f: &mut corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#<'_>,
36 type_name: &str,
37 token: &dyn corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#,
38 items: &[Element],
39 ) -> corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::fmtrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# {
40 f.debug_structrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/impl#[`Formatter<'a>`]debug_struct().(type_name)
41 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("val", &items)
42 .fieldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]field().("simd", token)
43 .finishrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/builders/impl#[`DebugStruct<'a, 'b>`]finish().()
44 }
45
46 /// Selects the input operands to be used for `slignr`/`vext`/etc. when computing a single output block for cross-block
47 /// "slide" operations. Extracts from [a : b].
48 #[inline(always)]
49 #[allow(clippy::allow_attributes, reason = "Only needed in some cfgs.")]
50 #[allow(dead_code, reason = "Only used in some cfgs.")]
51 pub(craterust-analyzer cargo fearless_simd 0.4.1 crate/) fn cross_block_slide_blocks_atrust-analyzer cargo fearless_simd 0.4.1 support/cross_block_slide_blocks_at().<const N: usize, Block: Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy#>(
52 a: &[Block; N],
53 b: &[Block; N],
54 out_idx: usize,
55 shift_bytes: usize,
56 ) -> [Block; 2] {
57 const BLOCK_BYTESrust-analyzer cargo fearless_simd 0.4.1 support/BLOCK_BYTES.: usize = 16;
58 let out_byte_start = out_idx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().BLOCK_BYTESrust-analyzer cargo fearless_simd 0.4.1 support/BLOCK_BYTES. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().shift_bytes;
59 let lo_idx = out_byte_start.div_euclidrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]div_euclid().(BLOCK_BYTESrust-analyzer cargo fearless_simd 0.4.1 support/BLOCK_BYTES.);
60 let hi_idx = lo_idx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().1;
61 // Concatenation is [a : b], so indices 0..N are from a, indices N..2N are from b
62 let lo_block = if lo_idx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().N { a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().lo_idx]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). } else { b[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().lo_idx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().N]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). };
63 let hi_block = if hi_idx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]lt().N { a[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().hi_idx]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). } else { b[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().hi_idx rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().N]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). };
64 [lo_block, hi_block]
65 }