MCPcopy Create free account
hub / github.com/SpartanJ/eepp / isAsciiAVX2

Function isAsciiAVX2

src/eepp/core/string.cpp:1475–1494  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1473#ifdef EE_ARCH_X86_64
1474#if defined( __GNUC__ ) || defined( __clang__ )
1475__attribute__( ( target( "avx2" ) ) )
1476#endif
1477static bool isAsciiAVX2( const char32_t* data, size_t len, uint32_t limit ) {
1478 const char32_t* end = data + len;
1479 const __m256i maskVec = _mm256_set1_epi32( ~limit );
1480
1481 while ( data + 8 <= end ) {
1482 __m256i chunk = _mm256_loadu_si256( (const __m256i*)data );
1483 if ( _mm256_testz_si256( chunk, maskVec ) == 0 )
1484 return false;
1485 data += 8;
1486 }
1487
1488 while ( data < end ) {
1489 if ( *data > limit )
1490 return false;
1491 data++;
1492 }
1493 return true;
1494}
1495#endif
1496
1497#ifdef EE_ARCH_ARM64

Callers 1

isAsciiTplFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected