raise the limit of strings in double shufti

This commit is contained in:
Alex Coyte
2016-04-04 15:54:09 +10:00
committed by Matthew Barr
parent c0a5b037a1
commit ed3ef5b997
5 changed files with 22 additions and 26 deletions

View File

@@ -284,7 +284,7 @@ AccelScheme make_double_accel(AccelScheme as, CharReach cr_1,
return as;
}
if (two_count > 8) {
if (two_count > DOUBLE_SHUFTI_LIMIT) {
if (cr_2.count() < cr_1.count()) {
as.double_cr |= cr_2;
offset = offset_in + 1;
@@ -513,7 +513,7 @@ AccelScheme findBestAccelScheme(vector<vector<CharReach> > paths,
best.offset = offset;
/* merge best single and best double */
if (!da.double_byte.empty() && da.double_byte.size() <= 8
if (!da.double_byte.empty() && da.double_byte.size() <= DOUBLE_SHUFTI_LIMIT
&& da.double_cr.count() < best.cr.count()) {
best.double_byte = da.double_byte;
best.double_cr = da.double_cr;
@@ -857,7 +857,8 @@ depth_done:
// literals)
if (depth > 1) {
for (unsigned int i = 0; i < (depth - 1); i++) {
if (depthReach[i].count()*depthReach[i+1].count() <= 8) {
if (depthReach[i].count() * depthReach[i+1].count()
<= DOUBLE_SHUFTI_LIMIT) {
DEBUG_PRINTF("two-byte shufti, depth %u\n", i);
*as = AccelScheme(CharReach::dot(), i);
return true;

View File

@@ -63,6 +63,8 @@ void findAccelFriends(const NGHolder &g, NFAVertex v,
u32 offset,
ue2::flat_set<NFAVertex> *friends);
#define DOUBLE_SHUFTI_LIMIT 20
struct AccelScheme {
AccelScheme(const CharReach &cr_in, u32 offset_in)
: cr(cr_in), offset(offset_in) {
@@ -78,10 +80,10 @@ struct AccelScheme {
size_t a_dcount = double_cr.count();
size_t b_dcount = b.double_cr.count();
bool feasible_double_a
= !a.double_byte.empty() && a.double_byte.size() <= 8;
bool feasible_double_b
= !b.double_byte.empty() && b.double_byte.size() <= 8;
bool feasible_double_a = !a.double_byte.empty()
&& a.double_byte.size() <= DOUBLE_SHUFTI_LIMIT;
bool feasible_double_b = !b.double_byte.empty()
&& b.double_byte.size() <= DOUBLE_SHUFTI_LIMIT;
if (feasible_double_a != feasible_double_b) {
return feasible_double_a > feasible_double_b;