Mercurial > hg > Game > Cerium
changeset 1642:b975f29893c7 draft
fix regex_mas
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 18 Jun 2013 21:42:58 +0900 |
parents | 289378e5abf8 |
children | 6c0b6947c231 |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc example/regex_mas/ppe/Print.cc |
diffstat | 3 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Tue Jun 18 18:52:42 2013 +0900 +++ b/example/regex_mas/main.cc Tue Jun 18 21:42:58 2013 +0900 @@ -12,7 +12,7 @@ #include "Func.h" #include "WordCount.h" -#define EXTRA_LENGTH 3 //多く取ってくる文字数 +#define EXTRA_LENGTH 4 //多く取ってくる文字数(search word length - 1) /* ;TODO * PS3でCPU数が2以上の時に、あまりが計算されてない @@ -173,7 +173,7 @@ } /*sizeをページングサイズの倍数にあわせる*/ - st_mmap.size = fix_byte(sb.st_size,4096 + EXTRA_LENGTH); //セグフォ防止 + st_mmap.size = fix_byte(sb.st_size,4096 + EXTRA_LENGTH); st_mmap.file_mmap = (char*)mmap(NULL,st_mmap.size,PROT_READ,map,fd,(off_t)0); if (st_mmap.file_mmap == (caddr_t)-1) {
--- a/example/regex_mas/ppe/Exec.cc Tue Jun 18 18:52:42 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Tue Jun 18 21:42:58 2013 +0900 @@ -33,7 +33,7 @@ while (text[i] == pattern[j]){ if (j == 0){ match_string[2*k] = text[i]; - int position = (long int)offset + i; + int position = (long int)offset + i + 1; match_string[2*k+1] = position; k++; @@ -53,11 +53,11 @@ unsigned long long *o_data = (unsigned long long*)wbuf; int length = (int)s->get_inputSize(0); int *offset = (int*)s->get_param(1); - unsigned char search_word[] = "aba"; + unsigned char search_word[] = "Pakis"; //printf("offset = %ld\n",(long int)offset); BM_method(i_data,offset,length,search_word,o_data); - s->printf("in Exec.cc\n"); + //s->printf("in Exec.cc\n"); return 0;
--- a/example/regex_mas/ppe/Print.cc Tue Jun 18 18:52:42 2013 +0900 +++ b/example/regex_mas/ppe/Print.cc Tue Jun 18 21:42:58 2013 +0900 @@ -17,11 +17,11 @@ s->printf("task num : %d\n",w->task_spwaned); s->printf("position\n"); - for (int i = 0;i < idata_task_num ;i++) { + for (int i = 0;i < idata_task_num/2;i++) { if(idata[2*i] == 0x61){ s->printf("%d ",(int)idata[2*i+1]); - s->printf("%c\n",(char)idata[2*i]); + s->printf("%c\n",(unsigned char)idata[2*i]); } } return 0;