MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / zip_f64x2

Method zip_f64x2

crates/tinywasm/src/interpreter/simd/mod.rs:119–131  ·  view source on GitHub ↗
(self, rhs: Self, mut op: impl FnMut(f64, f64) -> f64)

Source from the content-addressed store, hash-verified

117
118 #[inline]
119 fn zip_f64x2(self, rhs: Self, mut op: impl FnMut(f64, f64) -> f64) -> Self {
120 let a_bytes = self.0;
121 let b_bytes = rhs.0;
122 let mut out_bytes = [0u8; 16];
123
124 for ((a, b), dst) in a_bytes.chunks_exact(8).zip(b_bytes.chunks_exact(8)).zip(out_bytes.chunks_exact_mut(8)) {
125 let a_lane = f64::from_bits(u64::from_le_bytes([a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7]]));
126 let b_lane = f64::from_bits(u64::from_le_bytes([b[0], b[1], b[2], b[3], b[4], b[5], b[6], b[7]]));
127 dst.copy_from_slice(&op(a_lane, b_lane).to_bits().to_le_bytes());
128 }
129
130 Self(out_bytes)
131 }
132}

Callers 2

f64x2_relaxed_maddMethod · 0.80
f64x2_relaxed_nmaddMethod · 0.80

Calls 2

to_le_bytesMethod · 0.80
copy_from_sliceMethod · 0.45

Tested by

no test coverage detected