Skip to content

Commit

Permalink
deploy: 4697d39
Browse files Browse the repository at this point in the history
  • Loading branch information
calebzulawski committed Aug 25, 2024
1 parent b1a3aab commit 5304ce3
Show file tree
Hide file tree
Showing 8 changed files with 213 additions and 95 deletions.
72 changes: 40 additions & 32 deletions core_simd/simd/num/trait.SimdInt.html

Large diffs are not rendered by default.

48 changes: 28 additions & 20 deletions core_simd/simd/num/trait.SimdUint.html

Large diffs are not rendered by default.

84 changes: 47 additions & 37 deletions core_simd/simd/struct.Simd.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion search-index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion search.desc/core_simd/core_simd-desc-0-.js

Large diffs are not rendered by default.

50 changes: 48 additions & 2 deletions src/core_simd/simd/num/int.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,32 @@
<a href="#369" id="369">369</a>
<a href="#370" id="370">370</a>
<a href="#371" id="371">371</a>
<a href="#372" id="372">372</a>
<a href="#373" id="373">373</a>
<a href="#374" id="374">374</a>
<a href="#375" id="375">375</a>
<a href="#376" id="376">376</a>
<a href="#377" id="377">377</a>
<a href="#378" id="378">378</a>
<a href="#379" id="379">379</a>
<a href="#380" id="380">380</a>
<a href="#381" id="381">381</a>
<a href="#382" id="382">382</a>
<a href="#383" id="383">383</a>
<a href="#384" id="384">384</a>
<a href="#385" id="385">385</a>
<a href="#386" id="386">386</a>
<a href="#387" id="387">387</a>
<a href="#388" id="388">388</a>
<a href="#389" id="389">389</a>
<a href="#390" id="390">390</a>
<a href="#391" id="391">391</a>
<a href="#392" id="392">392</a>
<a href="#393" id="393">393</a>
<a href="#394" id="394">394</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">super</span>::sealed::Sealed;
<span class="kw">use </span><span class="kw">crate</span>::simd::{
cmp::SimdPartialOrd, num::SimdUint, LaneCount, Mask, Simd, SimdCast, SimdElement,
cmp::SimdOrd, cmp::SimdPartialOrd, num::SimdUint, LaneCount, Mask, Simd, SimdCast, SimdElement,
SupportedLaneCount,
};

Expand Down Expand Up @@ -441,11 +464,27 @@
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::prelude::*;
/// use core::i32::{MIN, MAX};
/// let xs = Simd::from_array([MIN, MIN +1, -5, 0]);
/// let xs = Simd::from_array([MIN, MIN + 1, -5, 0]);
/// assert_eq!(xs.abs(), Simd::from_array([MIN, MAX, 5, 0]));
/// ```
</span><span class="kw">fn </span>abs(<span class="self">self</span>) -&gt; <span class="self">Self</span>;

<span class="doccomment">/// Lanewise absolute difference.
/// Every element becomes the absolute difference of `self` and `second`.
///
/// # Examples
/// ```
/// # #![feature(portable_simd)]
/// # #[cfg(feature = "as_crate")] use core_simd::simd;
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::prelude::*;
/// use core::i32::{MIN, MAX};
/// let a = Simd::from_array([MIN, MAX, 100, -100]);
/// let b = Simd::from_array([MAX, MIN, -80, -120]);
/// assert_eq!(a.abs_diff(b), Simd::from_array([u32::MAX, u32::MAX, 180, 20]));
/// ```
</span><span class="kw">fn </span>abs_diff(<span class="self">self</span>, second: <span class="self">Self</span>) -&gt; <span class="self">Self</span>::Unsigned;

<span class="doccomment">/// Lanewise saturating absolute value, implemented in Rust.
/// As abs(), except the MIN value becomes MAX instead of itself.
///
Expand Down Expand Up @@ -630,6 +669,13 @@
(<span class="self">self</span>^m) - m
}

<span class="attr">#[inline]
</span><span class="kw">fn </span>abs_diff(<span class="self">self</span>, second: <span class="self">Self</span>) -&gt; <span class="self">Self</span>::Unsigned {
<span class="kw">let </span>max = <span class="self">self</span>.simd_max(second);
<span class="kw">let </span>min = <span class="self">self</span>.simd_min(second);
(max - min).cast()
}

<span class="attr">#[inline]
</span><span class="kw">fn </span>saturating_abs(<span class="self">self</span>) -&gt; <span class="self">Self </span>{
<span class="comment">// arith shift for -1 or 0 mask based on sign bit, giving 2s complement
Expand Down
48 changes: 47 additions & 1 deletion src/core_simd/simd/num/uint.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,31 @@
<a href="#219" id="219">219</a>
<a href="#220" id="220">220</a>
<a href="#221" id="221">221</a>
<a href="#222" id="222">222</a>
<a href="#223" id="223">223</a>
<a href="#224" id="224">224</a>
<a href="#225" id="225">225</a>
<a href="#226" id="226">226</a>
<a href="#227" id="227">227</a>
<a href="#228" id="228">228</a>
<a href="#229" id="229">229</a>
<a href="#230" id="230">230</a>
<a href="#231" id="231">231</a>
<a href="#232" id="232">232</a>
<a href="#233" id="233">233</a>
<a href="#234" id="234">234</a>
<a href="#235" id="235">235</a>
<a href="#236" id="236">236</a>
<a href="#237" id="237">237</a>
<a href="#238" id="238">238</a>
<a href="#239" id="239">239</a>
<a href="#240" id="240">240</a>
<a href="#241" id="241">241</a>
<a href="#242" id="242">242</a>
<a href="#243" id="243">243</a>
<a href="#244" id="244">244</a>
</pre></div><pre class="rust"><code><span class="kw">use </span><span class="kw">super</span>::sealed::Sealed;
<span class="kw">use </span><span class="kw">crate</span>::simd::{LaneCount, Simd, SimdCast, SimdElement, SupportedLaneCount};
<span class="kw">use </span><span class="kw">crate</span>::simd::{cmp::SimdOrd, LaneCount, Simd, SimdCast, SimdElement, SupportedLaneCount};

<span class="doccomment">/// Operations on SIMD vectors of unsigned integers.
</span><span class="kw">pub trait </span>SimdUint: Copy + Sealed {
Expand Down Expand Up @@ -278,6 +301,22 @@
/// assert_eq!(sat, Simd::splat(0));
</span><span class="kw">fn </span>saturating_sub(<span class="self">self</span>, second: <span class="self">Self</span>) -&gt; <span class="self">Self</span>;

<span class="doccomment">/// Lanewise absolute difference.
/// Every element becomes the absolute difference of `self` and `second`.
///
/// # Examples
/// ```
/// # #![feature(portable_simd)]
/// # #[cfg(feature = "as_crate")] use core_simd::simd;
/// # #[cfg(not(feature = "as_crate"))] use core::simd;
/// # use simd::prelude::*;
/// use core::u32::MAX;
/// let a = Simd::from_array([0, MAX, 100, 20]);
/// let b = Simd::from_array([MAX, 0, 80, 200]);
/// assert_eq!(a.abs_diff(b), Simd::from_array([MAX, MAX, 20, 180]));
/// ```
</span><span class="kw">fn </span>abs_diff(<span class="self">self</span>, second: <span class="self">Self</span>) -&gt; <span class="self">Self</span>;

<span class="doccomment">/// Returns the sum of the elements of the vector, with wrapping addition.
</span><span class="kw">fn </span>reduce_sum(<span class="self">self</span>) -&gt; <span class="self">Self</span>::Scalar;

Expand Down Expand Up @@ -359,6 +398,13 @@
</span><span class="kw">unsafe </span>{ core::intrinsics::simd::simd_saturating_sub(<span class="self">self</span>, second) }
}

<span class="attr">#[inline]
</span><span class="kw">fn </span>abs_diff(<span class="self">self</span>, second: <span class="self">Self</span>) -&gt; <span class="self">Self </span>{
<span class="kw">let </span>max = <span class="self">self</span>.simd_max(second);
<span class="kw">let </span>min = <span class="self">self</span>.simd_min(second);
max - min
}

<span class="attr">#[inline]
</span><span class="kw">fn </span>reduce_sum(<span class="self">self</span>) -&gt; <span class="self">Self</span>::Scalar {
<span class="comment">// Safety: `self` is an integer vector
Expand Down
2 changes: 1 addition & 1 deletion type.impl/core_simd/simd/struct.Simd.js

Large diffs are not rendered by default.

0 comments on commit 5304ce3

Please sign in to comment.