Mercurial > hg > Game > Cerium
view example/Miller_Rabin/ppe/PrintTask.cc @ 2064:f786ffb2a198 draft
add bm.h
author | Nozomi |
---|---|
date | Wed, 17 Feb 2016 17:37:06 +0900 |
parents | ff23aec3d651 |
children |
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 ",(int)2); /* 素数の判定結果が1ならば出力する */ for (U64 i = 1; i < size; i++) { if ( input[i] == true ) { printf("%llu ",i*2+1); } } printf("\n"); return 0; }