Mercurial > hg > Game > Cerium
view example/word_count/spe/Print.cc @ 626:0e91ddaad798 draft
64bit mode compatibility on Cell
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 16 Nov 2009 11:37:26 +0900 |
parents | 839e34d0cc3c |
children | 852ed17d8af1 |
line wrap: on
line source
#include <stdio.h> #include <string.h> #include "Print.h" #include "Func.h" /* これは必須 */ SchedDefineTask(Print); static int run(SchedTask *s, void *rbuf, void *wbuf) { unsigned long long *idata = (unsigned long long*)s->get_input(rbuf, 0); int task_num = (long)s->get_param(0); int status_num = (long)s->get_param(1); unsigned long long word_data[task_num]; for (int i = 0; i < status_num; i++) { word_data[i] = 0; } for (int i = 0; i < task_num*status_num; i += status_num) { for (int j = 0; j < status_num; j++) { word_data[j] += idata[i+j]; } } for (int i = 0; i < status_num; i++) { s->printf("%llu ",word_data[i]); } s->printf("\n"); return 0; }