Mercurial > hg > Game > Cerium
changeset 1650:1c0c49cd5275 draft
fix
author | Masa <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 25 Jun 2013 16:54:31 +0900 |
parents | 05e59edd0743 |
children | c134dd2e2f4e |
files | example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc |
diffstat | 2 files changed, 12 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/main.cc Tue Jun 25 15:03:08 2013 +0900 +++ b/example/regex_mas/main.cc Tue Jun 25 16:54:31 2013 +0900 @@ -28,7 +28,7 @@ int use_compat = 0; int array_task_num = 8; int spe_num = 1; -unsigned char search_word[256]; +unsigned char* search_word; CPU_TYPE spe_cpu = SPE_ANY; const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-file filename]\n"; @@ -268,12 +268,12 @@ const int ONE_TASK_LENGTH = w->division_size; 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,length); const int ONE_LOOP_LENGTH = array_task_num*spe_num*ONE_TASK_LENGTH; const int ARRAY_LENGTH_SIZE = spe_num * ONE_TASK_LENGTH; int offset = ONE_LOOP_LENGTH * i + ARRAY_LENGTH_SIZE*j + ONE_TASK_LENGTH*k; - t_exec[k]->set_param(1,(memaddr)offset); - t_exec[k]->set_param(2,(memaddr)search_word); + t_exec[k]->set_param(3,offset); + t_exec[k]->set_param(1,search_word); //printf("%s\n",search_word); if(size != w->size){ //ラストのタスクかどうかの判定 t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH); @@ -481,7 +481,8 @@ spe_num = atoi(argv[i+1]); if (spe_num==0) spe_num = 1; } else if (strcmp(argv[i], "-sw") == 0) { - strcpy((char*)search_word,argv[i+1]); + // strcpy((char*)search_word,argv[i+1]); + search_word = (unsigned char*)argv[i+1]; } } if (filename==0) {
--- a/example/regex_mas/ppe/Exec.cc Tue Jun 25 15:03:08 2013 +0900 +++ b/example/regex_mas/ppe/Exec.cc Tue Jun 25 16:54:31 2013 +0900 @@ -9,7 +9,7 @@ SchedDefineTask(Exec); //ボイヤームーア法による文字列検索アルゴリズム -int BM_method(unsigned char *text,int *offset,int text_length, +int BM_method(unsigned char *text,long int offset,int text_length, unsigned char *pattern,unsigned long long *match_string) { int skip[256]; @@ -51,13 +51,13 @@ { unsigned char *i_data = (unsigned 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); - unsigned char *search_word = (unsigned char*)s->get_param(2); + long length = (long)s->get_param(0); + long int offset = (long int)s->get_param(3); + unsigned char* search_word = (unsigned char*)s->get_param(1); //unsigned char search_word[] = "aba"; - s->printf("%s\n",search_word); + s->printf("%ld,%ld,%s\n",length,offset,search_word); - BM_method(i_data,offset,length,search_word,o_data); + BM_method(i_data,offset,(int)length,search_word,o_data); //s->printf("in Exec.cc\n");