daily update on 20240206 by nitload youmu, token parser change to use regex generator
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#include "StgSharpC.h"
|
||||
#include "ssc_intrinsic.h"
|
||||
|
||||
int index_pair_sse(byte const *str, uint32_t target, int length)
|
||||
{
|
||||
int index = 0, result = 0, size = length << 1, end = size - 14;
|
||||
__m128i source = { .m128i_i32 = {
|
||||
target,
|
||||
target,
|
||||
target,
|
||||
target,
|
||||
} };
|
||||
for (; (index < end) && (!result); index += 14) { // move 7*2 bytes instead of 8*2
|
||||
__m128i vec = _mm_loadu_epi32(str + index);
|
||||
__m128i com = _mm_cmpeq_epi32(vec, source);
|
||||
result = _mm_movemask_epi8(com);
|
||||
}
|
||||
if (result) {
|
||||
for (; result; result >> 2) {
|
||||
index++;
|
||||
}
|
||||
return index;
|
||||
}
|
||||
for (; (index < size - 2) && (!result); index += 2) {
|
||||
result = *(int *)(str + index) == target;
|
||||
}
|
||||
if (result) {
|
||||
return index;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
Reference in New Issue
Block a user