# HG changeset patch # User Masataka Kohagura # Date 1384232009 -32400 # Node ID dfeeb2f681dbf4fc30f39c44b1431bc9474379be # Parent 893353c014f59da6f917ebac597abe267ad637aa fix BMsearch diff -r 893353c014f5 -r dfeeb2f681db example/regex_mas/ppe/Exec.cc --- a/example/regex_mas/ppe/Exec.cc Sun Nov 03 19:00:45 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Tue Nov 12 13:53:29 2013 +0900 @@ -1,8 +1,5 @@ #include #include -#include -#include -#include #include "Exec.h" #include "Func.h" #include "SchedTask.h" @@ -15,26 +12,19 @@ int BM_method(unsigned char *text,int *offset,int *text_length, unsigned char *pattern,unsigned long long *match_string) { - using std::vector; - //int skip[256]; + int skip[256]; int text_len = (long int)text_length; int pattern_len = strlen((char *)pattern); int i = 0; int match_counter = 0; - std::vector vecSkipTable(256,pattern_len); - //for (i = 0; i < 256; ++i){ - // skip[i] = pattern_len; - //} + for (i = 0; i < 256; ++i){ + skip[i] = pattern_len; + } - vecSkipTable[100] = 4; - vecSkipTable[111] = 3; - vecSkipTable[105] = 2; - vecSkipTable[110] = 1; - - //for (i = 0; i < pattern_len-1 ; ++i){ - // skip[(int)pattern[i]] = pattern_len - i - 1; - //} + for (i = 0; i < pattern_len-1 ; ++i){ + skip[(int)pattern[i]] = pattern_len - i - 1; + } @@ -49,8 +39,7 @@ --i; --j; } - //i = i + max((int)skip[(int)text[i]],pattern_len - j); - i = i + max((int)vecSkipTable[(int)text[i]],pattern_len - j); + i = i + max((int)skip[(int)text[i]],pattern_len - j); } return match_counter; }