Help compilers vectorize

This commit is contained in:
Frank Denis 2017-11-18 13:09:13 +01:00
parent c190574cee
commit 686c6a210d

View File

@ -26,19 +26,21 @@ has_small_order(const unsigned char s[32])
{ 0xda, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff },
{ 0xdb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }
};
unsigned char c[12] = { 0 };
unsigned int k;
size_t i, j;
unsigned char c;
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
c = 0;
for (j = 0; j < 32; j++) {
c |= s[j] ^ blacklist[i][j];
}
if (c == 0) {
return 1;
COMPILER_ASSERT(12 == sizeof blacklist / sizeof blacklist[0]);
for (j = 0; j < 32; j++) {
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
c[i] |= s[j] ^ blacklist[i][j];
}
}
return 0;
k = 0;
for (i = 0; i < sizeof blacklist / sizeof blacklist[0]; i++) {
k |= (c[i] - 1);
}
return (int) ((k >> 8) & 1);
}
static int