本文整理汇总了C++中OperationArgs::reg_for_slot方法的典型用法代码示例。如果您正苦于以下问题:C++ OperationArgs::reg_for_slot方法的具体用法?C++ OperationArgs::reg_for_slot怎么用?C++ OperationArgs::reg_for_slot使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OperationArgs
的用法示例。
在下文中一共展示了OperationArgs::reg_for_slot方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: E
extern "C" closure builtin_function_new_random_modifiable(OperationArgs& Args)
{
// assert(not Args.evaluate_changeables());
reg_heap& M = Args.memory();
int R1 = Args.reg_for_slot(0);
int R2 = Args.reg_for_slot(1);
int V = Args.reg_for_slot(2);
int rate = Args.reg_for_slot(3);
// Allocate a reg, and fill it with a modifiable of the correct index
expression_ref E(new expression(modifiable(),{index_var(2),index_var(1),index_var(0)}));
closure C{E,{R2,R1,rate}};
int r = Args.allocate(std::move(C));
M.make_reg_changeable(r);
M.set_shared_value(r,V);
M.add_random_modifiable(r);
// Return a reference to the new modifiable.
return {index_var(0),{r}};
}
示例2: constructor
extern "C" closure builtin_function_register_probability(OperationArgs& Args)
{
assert(not Args.evaluate_changeables());
int R = Args.reg_for_slot(0);
auto& M = Args.memory();
M.register_probability(R);
return constructor("()",0);
}
示例3: myexception
extern "C" closure builtin_function_evaluate(OperationArgs& Args)
{
auto& M = Args.memory();
int c = Args.evaluate(0).as_int();
#ifndef NDEBUG
if (Args.evaluate_changeables() and c >= 0)
throw myexception()<<"Calling builtin_function_evaluate( ) when evaluate_changeables=true and c >= 0";
#endif
int R1 = Args.reg_for_slot(1);
int R2 = 0;
if (c < 0)
R2 = M.incremental_evaluate_unchangeable(R1);
else
R2 = M.incremental_evaluate_in_context(R1, c).first;
assert( R2 );
return {index_var(0),{R2}};
}