Mercurial > hg > Game > Cerium
view example/Miller_Rabin/ppe/PrintTask.cc @ 1244:cd50c48f45e7 draft real_matrix
fix
author | Daichi Toma <amothic@gmail.com> |
---|---|
date | Thu, 03 Nov 2011 20:40:17 +0900 |
parents | 9d37fa6bc1da |
children | ff23aec3d651 |
line wrap: on
line source
#include <stdio.h> #include "SchedTask.h" #include "PrintTask.h" #include "Func.h" typedef unsigned long long U64; SchedDefineTask1(PrintTask, print); static int print(SchedTask *smanager, void *rbuf, void *wbuf) { bool print_flag = (bool)smanager->get_param(1); //プリントするかどうか if (print_flag == false) { return 0; } U64 size = ((U64)smanager->get_param(0)) >> 1; /* 出力する範囲 */ bool *input = (bool*)smanager->get_input(rbuf, 0); /* 出力する配列 */ printf("%d\n",(int)2); /* 素数の判定結果が1ならば出力する */ for (U64 i = 1; i < size; i++) { if ( input[i] == true ) { printf("%llu\n",i*2+1); } } return 0; }