MCPcopy Create free account
hub / github.com/devosoft/avida / Inst_Val_Mod

Method Inst_Val_Mod

avida-core/source/cpu/cHardwareTransSMT.cc:1317–1332  ·  view source on GitHub ↗

13

Source from the content-addressed store, hash-verified

1315
1316//13
1317bool cHardwareTransSMT::Inst_Val_Mod(cAvidaContext&)
1318{
1319 const int dst = FindModifiedStack(STACK_BX);
1320 const int op1 = FindModifiedStack(STACK_BX);
1321 const int op2 = FindModifiedNextStack(op1);
1322 if (Stack(op2).Top() != 0) {
1323 if(Stack(op2).Top() == -1)
1324 Stack(dst).Push(0);
1325 else
1326 Stack(dst).Push(Stack(op1).Top() % Stack(op2).Top());
1327 } else {
1328 m_organism->Fault(FAULT_LOC_MATH, FAULT_TYPE_ERROR, "mod: modding by 0");
1329 return false;
1330 }
1331 return true;
1332}
1333
1334//14
1335bool cHardwareTransSMT::Inst_Val_Inc(cAvidaContext&)

Callers

nothing calls this directly

Calls 4

TopMethod · 0.80
FaultMethod · 0.80
StackClass · 0.70
PushMethod · 0.45

Tested by

no test coverage detected