玩具项目,不过真的很好玩!

```c
int prime_factor_co(Co *co, void *data)
{
PrimeFactorData *pfData = (PrimeFactorData *)data;
CO_BEGIN(co);

pfData->current = 2;
while (pfData->number > 1)
{
while (pfData->number % pfData->current == 0)
{
pfData->number /= pfData->current;
pfData->factor = pfData->current;
CO_YIELD(co, pfData->factor);
}
pfData->current++;
CO_YIELD(co, 0); // Yield to indicate progress
}

CO_END(co);
return 0;
}
```

https://zhuanlan.zhihu.com/p/710329144
https://github.com/pluveto/minico
最新回复 (0)
返回