Mercurial > hg > Game > Cerium
changeset 1620:bb0384fb5a56 draft
add separeta in word process
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 18 May 2013 20:20:10 +0900 |
parents | 64f8db4e8356 |
children | f907bbac14f2 |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc example/regex_mas/ppe/Print.cc |
diffstat | 3 files changed, 12 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Tue May 14 17:49:36 2013 +0900 +++ b/example/regex_mas/main.cc Sat May 18 20:20:10 2013 +0900 @@ -264,7 +264,7 @@ int length = size/sizeof(char); t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); - t_exec[k]->set_param(0,(memaddr)length); + t_exec[k]->set_param(0,(memaddr)length + 1); const int ONE_LOOP_LENGTH = array_task_num*spe_num*length; const int ARRAY_LENGTH_SIZE = spe_num * length; int offset = ONE_LOOP_LENGTH * i + ARRAY_LENGTH_SIZE*j+length*k;
--- a/example/regex_mas/ppe/Exec.cc Tue May 14 17:49:36 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Sat May 18 20:20:10 2013 +0900 @@ -14,33 +14,22 @@ char *i_data = (char *)rbuf; unsigned long long *o_data = (unsigned long long*)wbuf; int length = (int)s->get_inputSize(0); - //int *offset = (int*)s->get_param(1); - //printf("offset = %d\n",offset); + int *offset = (int*)s->get_param(1); + printf("offset = %d\n",offset); int i = 0; int j = 0; - int line_head_diff = 1; bool a_flag = 0; bool match_flag = 0; for (; i < length; i++) { - if (i_data[i] == 0x0A) { - - if (match_flag == true) { - o_data[j] = *((char *)rbuf + i - line_head_diff + 1); - j++; - } - match_flag = false; - line_head_diff = 0; - } else { - if (i_data[i] == 0x61) { - a_flag = true; - }else if ((i_data[i] == 0x62) && (a_flag == true)) { - match_flag = true; - }else if (i_data[i] == 0x20) { - a_flag = false; - } - } - line_head_diff++; + if (i_data[i] == 0x61) { + a_flag = true; + }else if ((i_data[i] == 0x62) && (a_flag == true)) { + o_data[j] = *((char *)rbuf + i - 2); + match_flag = true; + }else{ + a_flag = false; + } } return 0;
--- a/example/regex_mas/ppe/Print.cc Tue May 14 17:49:36 2013 +0900 +++ b/example/regex_mas/ppe/Print.cc Sat May 18 20:20:10 2013 +0900 @@ -13,7 +13,7 @@ WordCount *w = *(WordCount**)rbuf; unsigned long long *idata = w->o_data; // long task_num = w->task_num; - for (int i = 0;i < 4;i++) { + for (int i = 0;i < 8;i++) { s->printf("%c\n",(char)idata[i]); } return 0;