|
|
|
|
|
by camel-cdr
371 days ago
|
|
The usual way to do this in SIMD is via vpermb(lut, str) == str, or potentially slightly faster vpshufb(str>>1, lut) == str. str|0x32 if you want case-insensitive. This works because the lowest five bits, more specifically bits two to five, of the vowels are distinct. The lut is zeroed except for the indices corresponding to the vowels, which contain it self: lut[vowel&31]=vowel or lut[(vowel&31)>>1]=vowel |
|
So in the comparison vs. the original str, vowels get a true and consonants get a false. Doesn't the "==" then returns true if all the chars are vowels?