Mercurial > hg > Game > Cerium
changeset 1747:efbb42f8077a draft
allocate local variable
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 20 Nov 2013 17:58:09 +0900 |
parents | f2f69b73afe9 |
children | 61370f2987ff |
files | example/regex_mas/WordCount.h example/regex_mas/main.cc |
diffstat | 2 files changed, 7 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/WordCount.h Mon Nov 18 18:15:04 2013 +0900 +++ b/example/regex_mas/WordCount.h Wed Nov 20 17:58:09 2013 +0900 @@ -15,6 +15,7 @@ int file_size; unsigned char *search_word; int search_word_len; + int extra_len; HTaskPtr t_print; } WordCount;
--- a/example/regex_mas/main.cc Mon Nov 18 18:15:04 2013 +0900 +++ b/example/regex_mas/main.cc Wed Nov 20 17:58:09 2013 +0900 @@ -90,6 +90,8 @@ run_tasks(SchedTask *manager, WordCount *w, int task_count, HTaskPtr t_next, int size) { + w->extra_len = w->search_word_len - 1; + if (task_count < array_task_num) { array_task_num = task_count; if (task_count<=0) return; @@ -125,20 +127,15 @@ if (w->size < size) size = w->size; - int set_one_task_length = size/sizeof(char); - //const int ONE_TASK_LENGTH = w->division_size; - //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] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); if(size != w->size){ //最後のタスクかどうかの判定 - t_exec[k]->set_param(0,&set_one_task_length + EXTRA_LENGTH); - t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH); + t_exec[k]->set_param(0,&w->division_size + w->extra_len); + t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, w->division_size + w->extra_len); t_exec[k]->set_inData(1,w->search_word, w->search_word_len); }else{ - t_exec[k]->set_param(0,&set_one_task_length); - t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size); + t_exec[k]->set_param(0,&w->division_size); + t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, w->division_size); t_exec[k]->set_inData(1,w->search_word, w->search_word_len); }