You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fury.apache.org by "chaokunyang (via GitHub)" <gi...@apache.org> on 2025/01/08 14:34:37 UTC
Re: [PR] feat(c++): add simd accelerated c++ ascii check funcion [fury]
chaokunyang commented on PR #1999:
URL: https://github.com/apache/fury/pull/1999#issuecomment-2577823419
> @chaokunyang Maybe,This feature is already implemented in `string_util.cc`
>
> ```c++
> bool isLatin(const std::string &str) {
> const char *data = str.data();
> size_t len = str.size();
>
> size_t i = 0;
> uint8x16_t latin_mask = vdupq_n_u8(0x80);
> for (; i + 16 <= len; i += 16) {
> uint8x16_t chars = vld1q_u8(reinterpret_cast<const uint8_t *>(data + i));
> uint8x16_t result = vandq_u8(chars, latin_mask);
> if (vmaxvq_u8(result) != 0) {
> return false;
> }
> }
>
> for (; i < len; ++i) {
> if (static_cast<unsigned char>(data[i]) >= 128) {
> return false;
> }
> }
>
> return true;
> }
> ```
I missed that, it's named as `isLatin`, it should be renamed to `isASCII`. Latin1 is superset of ascii
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@fury.apache.org
For additional commands, e-mail: commits-help@fury.apache.org