Skip to content

[x86] sse4.2 add docs for _SIDD_EQUAL_RANGES #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 11, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/x86/sse42.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,46 @@ pub unsafe fn _mm_cmpistrm(
/// # }
/// ```
///
/// Find the index of the first character in the haystack that is within a range
/// of characters.
///
/// ```
/// # #![feature(cfg_target_feature)]
/// # #![feature(target_feature)]
/// #
/// # #[macro_use] extern crate stdsimd;
/// #
/// # fn main() {
/// # if cfg_feature_enabled!("sse4.2") {
/// # #[target_feature = "+sse4.2"]
/// # fn worker() {
/// use stdsimd::simd::u8x16;
/// use stdsimd::vendor::{__m128i, _mm_cmpistri, _SIDD_CMP_RANGES};
/// # let b = __m128i::from(u8x16::load(b":;<=>?@[\\]^_`abc", 0));
///
/// // Specify the ranges of values to be searched for [A-Za-z0-9].
/// let a = __m128i::from(u8x16::load(b"AZaz09\0\0\0\0\0\0\0\0\0\0", 0));
///
/// // Use _SIDD_CMP_RANGES to find the index of first byte in ranges.
/// // Which in this case will be the first alpha numeric byte found
/// // in the string.
/// let idx = unsafe {
/// _mm_cmpistri(a, b, _SIDD_CMP_RANGES)
/// };
///
///
/// if idx < 16 {
/// println!("Found an alpha numeric character");
/// # assert_eq!(idx, 13);
/// } else {
/// println!("Did not find an alpha numeric character");
/// }
/// # }
/// # worker();
/// # }
/// # }
/// ```
///
/// Working with 16-bit characters.
///
/// ```
Expand Down