本文整理汇总了C++中bigint::lowbitset方法的典型用法代码示例。如果您正苦于以下问题:C++ bigint::lowbitset方法的具体用法?C++ bigint::lowbitset怎么用?C++ bigint::lowbitset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bigint
的用法示例。
在下文中一共展示了bigint::lowbitset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
} else if (endswith(outfilename, ".mc")) {
outputismc = 1 ;
#ifdef ZLIB
} else if (endswith(outfilename, ".rle.gz")) {
outputgzip = 1 ;
} else if (endswith(outfilename, ".mc.gz")) {
outputismc = 1 ;
outputgzip = 1 ;
#endif
} else {
lifefatal("Output filename must end with .rle or .mc.") ;
}
if (strlen(outfilename) > 200)
lifefatal("Output filename too long") ;
}
if (timeline && hyper)
lifefatal("Cannot use both timeline and exponentially increasing steps") ;
imp = createUniverse() ;
if (progress)
lifeerrors::seterrorhandler(&progerrors_instance) ;
else
lifeerrors::seterrorhandler(&stderrors_instance) ;
if (verbose) {
hlifealgo::setVerbose(1) ;
}
imp->setMaxMemory(maxmem) ;
#ifdef TIMING
timestamp() ;
#endif
if (testscript) {
if (argc > 1) {
filename = argv[1] ;
const char *err = readpattern(argv[1], *imp) ;
if (err) lifefatal(err) ;
}
runtestscript(testscript) ;
}
filename = argv[1] ;
const char *err = readpattern(argv[1], *imp) ;
if (err) lifefatal(err) ;
if (liferule) {
err = imp->setrule(liferule) ;
if (err) lifefatal(err) ;
}
bool boundedgrid = (imp->gridwd > 0 || imp->gridht > 0) ;
if (boundedgrid) {
hyper = 0 ;
inc = 1 ; // only step by 1
}
if (inc != 0)
imp->setIncrement(inc) ;
if (timeline) {
int lowbit = inc.lowbitset() ;
bigint t = 1 ;
for (int i=0; i<lowbit; i++)
t.mul_smallint(2) ;
if (t != inc)
lifefatal("Bad increment for timeline") ;
imp->startrecording(2, lowbit) ;
}
int fc = 0 ;
for (;;) {
if (quiet < 2) {
cout << imp->getGeneration().tostring() ;
if (!quiet)
cout << ": " << imp->getPopulation().tostring() << endl ;
else
cout << endl ;
}
if (popcount)
imp->getPopulation() ;
if (autofit)
imp->fit(viewport, 1) ;
if (render)
imp->draw(viewport, renderer) ;
if (maxgen >= 0 && imp->getGeneration() >= maxgen)
break ;
if (!hyper && maxgen > 0 && inc == 0) {
bigint diff = maxgen ;
diff -= imp->getGeneration() ;
int bs = diff.lowbitset() ;
diff = 1 ;
diff <<= bs ;
imp->setIncrement(diff) ;
}
if (boundedgrid && !imp->CreateBorderCells()) break ;
imp->step() ;
if (boundedgrid && !imp->DeleteBorderCells()) break ;
if (timeline) imp->extendtimeline() ;
if (maxgen < 0 && outfilename != 0)
writepat(fc++) ;
if (timeline && imp->getframecount() + 2 > MAX_FRAME_COUNT)
imp->pruneframes() ;
if (hyper)
imp->setIncrement(imp->getGeneration()) ;
}
if (maxgen >= 0 && outfilename != 0)
writepat(-1) ;
exit(0) ;
}