Mercurial > hg > Game > Cerium
comparison example/Prime/ppe/PrintTask.cc @ 1171:d910c8377a09 draft
add prime example
author | Daichi TOMA <amothic@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 04 Jun 2011 17:26:14 +0900 |
parents | |
children | 898fdcf53c31 |
comparison
equal
deleted
inserted
replaced
1170:693e58f4a672 | 1171:d910c8377a09 |
---|---|
1 #include <stdio.h> | |
2 #include "SchedTask.h" | |
3 #include "PrintTask.h" | |
4 #include "Func.h" | |
5 | |
6 SchedDefineTask1(PrintTask, print); | |
7 | |
8 static int | |
9 print(SchedTask *smanager, void *rbuf, void *wbuf) | |
10 { | |
11 int length = (int)smanager->get_param(0); /* 出力する範囲 */ | |
12 int *input = (int*)smanager->get_input(rbuf, 0); /* 出力する配列 */ | |
13 | |
14 /* 素数の判定結果が1ならば出力する */ | |
15 for (int i = 0; i < length; i++) { | |
16 if ( input[i] == 1 ) { | |
17 printf("%d ",i); | |
18 } | |
19 } | |
20 printf("\n"); | |
21 return 0; | |
22 } |