Mercurial > hg > Game > Cerium
view example/Prime/spe/PrintTask.cc @ 1243:9df036b11eae draft
fix printtask
author | Daichi Toma <amothic@gmail.com> |
---|---|
date | Tue, 01 Nov 2011 19:23:11 +0900 |
parents | 247da1f5e625 |
children | d2f70da2aa19 |
line wrap: on
line source
#include <stdio.h> #include "SchedTask.h" #include "PrintTask.h" #include "Func.h" SchedDefineTask1(PrintTask, print); static int print(SchedTask *smanager, void *rbuf, void *wbuf) { long print_flag = (long)smanager->get_param(1); //プリントするかどうか if (print_flag < 0) { return 0; } long length = (long)smanager->get_param(0); /* 出力する範囲 */ bool *input = (bool*)smanager->get_input(rbuf, 0); /* 出力する配列 */ input[0] = false; input[1] = false; /* 素数の判定結果が1ならば出力する */ for (long i = 0; i < length; i++) { if ( input[i] == true ) { printf("%ld ",i); } } printf("\n"); return 0; }