Skip to content

Commit

Permalink
Disable String::isAscii SIMD optimization for the lack of proper comp…
Browse files Browse the repository at this point in the history
…iler support :'(
  • Loading branch information
SpartanJ committed Jan 29, 2025
1 parent 1a3aeb3 commit 5e41247
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/eepp/core/string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1261,18 +1261,18 @@ bool String::isAscii() const {
size_t len = mString.size();
size_t i = 0;

#ifdef EE_STD_SIMD
using simd_type = simd::native_simd<char32_t>;
constexpr size_t simd_size = simd_type::size();
const simd_type ascii_limit = 127;
for ( ; i + simd_size - 1 < len; i += simd_size ) {
simd_type chunk;
chunk.copy_from( &data[i], simd::element_aligned );
auto mask = chunk > ascii_limit;
if ( simd::any_of( mask ) )
return false;
}
#endif
// #ifdef EE_STD_SIMD
// using simd_type = simd::native_simd<char32_t>;
// constexpr size_t simd_size = simd_type::size();
// const simd_type ascii_limit = 127;
// for ( ; i + simd_size - 1 < len; i += simd_size ) {
// simd_type chunk;
// chunk.copy_from( &data[i], simd::element_aligned );
// auto mask = chunk > ascii_limit;
// if ( simd::any_of( mask ) )
// return false;
// }
// #endif

for ( ; i < len; ++i )
if ( data[i] > 127 )
Expand Down

0 comments on commit 5e41247

Please sign in to comment.