pub unsafe fn partition_avx2(
indices: &[u32],
words: &[u64],
one: usize,
next: &mut [u32],
)Examples found in repository?
crates/competitive/src/data_structure/wavelet_matrix.rs (line 475)
455 pub fn new(v: Vec<T>) -> Self {
456 if v.len() <= u32::MAX as usize {
457 #[cfg(target_arch = "x86_64")]
458 let backend = super::simd_backend();
459 Self::from_values(
460 v,
461 |i| i as u32,
462 |i| i as usize,
463 |indices, d| {
464 #[cfg(target_arch = "x86_64")]
465 if backend != super::SimdBackend::Scalar && is_x86_feature_detected!("avx2") {
466 // SAFETY: AVX2 is available.
467 return unsafe { simd::pack_words(indices, d) };
468 }
469 Self::pack_words(indices, |i| (i >> d) & 1 != 0)
470 },
471 |indices, words, zeros, next| {
472 #[cfg(target_arch = "x86_64")]
473 if backend != super::SimdBackend::Scalar && is_x86_feature_detected!("avx2") {
474 // SAFETY: AVX2 is available, and the partition buffers have equal length.
475 unsafe { simd::partition_avx2(indices, words, zeros, next) };
476 return;
477 }
478 Self::partition(indices, words, zeros, next);
479 },
480 )
481 } else {
482 Self::from_values(
483 v,
484 |i| i,
485 |i| i,
486 |indices, d| Self::pack_words(indices, |i| (i >> d) & 1 != 0),
487 Self::partition,
488 )
489 }
490 }