diff example/word_count_test/spe/Exec.cc @ 667:d753b4f6b129

SimpeTask WordCount Worked.
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Thu, 03 Dec 2009 04:23:36 +0900
parents 4470ff271c5a
children bde5f13adf10
line wrap: on
line diff
--- a/example/word_count_test/spe/Exec.cc	Thu Dec 03 02:11:31 2009 +0900
+++ b/example/word_count_test/spe/Exec.cc	Thu Dec 03 04:23:36 2009 +0900
@@ -9,11 +9,18 @@
 static int
 run(SchedTask *s, void *rbuf, void *wbuf)
 {
+#ifdef SIMPLE_TASK
+    char *i_data = (char *)rbuf;
+    unsigned long long *o_data = (unsigned long long*)wbuf;
+    unsigned long long *head_tail_flag = o_data +2;
+    int length = s->read_size();
+#else
     char *i_data = (char*)s->get_input(rbuf, 0);
     unsigned long long *o_data = (unsigned long long*)s->get_output(wbuf, 0);
     /*担当範囲の先頭、末尾が「改行、スペース」か、「それ以外の文字」かのフラグ*/
     unsigned long long  *head_tail_flag = (unsigned long long*)s->get_output(wbuf,1);
     int length = (long)s->get_param(0);
+#endif
     int word_flag = 0;
     int word_num = 0;
     int line_num = 0;
@@ -51,7 +58,7 @@
     //printf("last word %c",i_data[i-1]);
     head_tail_flag[1] = (i_data[i-1] != 0x20) && (i_data[i-1] != 0x0A);
 
-    // s->printf("PPE word %d line %d\n",word_num,line_num);
+    // s->printf("SPE word %d line %d\n",word_num,line_num);
 
     o_data[0] = (unsigned long long)word_num;
     o_data[1] = (unsigned long long)line_num;