src/pcmp/eq16.h
/**
 * Compares the case-sensitive equality of two strings up to 16 bytes long.
 *
 * @param  s1  first memory sequence to compare
 * @param  s2  second memory sequence to compare
 * @param  n   length of sequence
 * @return  1 if the values are equal, 0 otherwise
 */
Compares the case-sensitive equality of two strings up to 16 bytes long.
@param  s1  first memory sequence to compare
@param  s2  second memory sequence to compare
@param  n   length of sequence
@return  1 if the values are equal, 0 otherwise
Compares the case - sensitive equality of two strings up to 16 bytes long . @param s1 first memory sequence to compare @param s2 second memory sequence to compare @param n length of sequence @return 1 if the values are equal 0 otherwise
static inline int
pcmp_eq16 (const uint8_t *restrict s1, const uint8_t *restrict s2, int n)
{
	__m128i m1 = _mm_lddqu_si128 ((const __m128i *)(void *)s1);
	__m128i m2 = _mm_lddqu_si128 ((const __m128i *)(void *)s2);
	return (n == _mm_cmpestri (
				m1, n, m2, 16,
				_SIDD_CMP_EQUAL_EACH | _SIDD_MASKED_NEGATIVE_POLARITY));
}
static inline int pcmp_eq16 ( const uint8_t * restrict s1 , const uint8_t * restrict s2 , int n ) { __m128i m1 = _mm_lddqu_si128 ( ( const __m128i * ) ( void * ) s1 ) ; __m128i m2 = _mm_lddqu_si128 ( ( const __m128i * ) ( void * ) s2 ) ; return ( n == _mm_cmpestri ( m1 , n , m2 , 16 , _SIDD_CMP_EQUAL_EACH | _SIDD_MASKED_NEGATIVE_POLARITY ) ) ; }
Compares the case-sensitive equality of two strings up to 16 bytes long.
Compares the case - sensitive equality of two strings up to 16 bytes long .
// load strings // compare strings and find the last matched index