Benign cargo Download

quicksort.rs

Contains an unbounded block loopRust test marker or harness
SHA-25634f6236909396c0aa5c3047d5854aa7543a2ffea56467f04c1c843a3d60e19ff
MaleculeH(Db)Md(Pa)

Evidence

imports rayon_core lines 1–14
1//! Parallel quicksort.
2//!
3//! This implementation is copied verbatim from `std::slice::sort_unstable` and then parallelized.
4//! The only difference from the original is that calls to `recurse` are executed in parallel using
5//! `rayon_core::join`.
6
7use rayon_core;
8use std::cmp;
9use std::mem;
10use std::ptr;
11
12/// When dropped, takes the value out of `Option` and writes it into `dest`.
13///
14/// This all …
English function-word token "for" lines 14–15
14:29… read the pivot into a stack-allocated variable for efficiency, and
15/// write it back into the slice after partitioning. This way we ensure that th …
Contains an unbounded block loop lines 184–191
184:49… parent >= child`.
185 let sift_down = |v: &mut [T], mut node| {
186 loop {
187 // Children of `node`:
188 let left = 2 * node + 1;
189 let right = 2 * node + 2;
190
191 // C …
English function-word token "with" lines 200–204
200:18… reak;
201 }
202
203 // Swap `node` with the greater child, move one step down, and continue sifting.
204 v.swap(node, greater); …
imports rand::distributions::Uniform lines 743–759
743:60… ng_zeros() as usize;
744
745 recurse(v, &is_less, None, limit);
746}
747
748#[cfg(test)]
749mod tests {
750 use rand::{thread_rng, Rng};
751 use rand::distributions::Uniform;
752 use super::heapsort;
753
754 #[test]
755 fn test_heapsort() {
756 let mut rng = thread_rng();
757
758 for len in (0..25).chain(500..501) {
759 for &mod …

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.