Fix handling of diffLead in SymbolTable::getOrigLeadLagForDiffAuxVar()

issue#70
Sébastien Villemot 2020-09-11 16:56:14 +02:00
parent d2cbe2a19e
commit db3ef925a7
No known key found for this signature in database
GPG Key ID: 2CECE9350ECEBE4A
1 changed files with 2 additions and 3 deletions

View File

@ -718,12 +718,11 @@ SymbolTable::getOrigSymbIdForAuxVar(int aux_var_symb_id) const noexcept(false)
int
SymbolTable::getOrigLeadLagForDiffAuxVar(int diff_aux_var_symb_id) const noexcept(false)
{
int lag = 0;
for (const auto &aux_var : aux_vars)
if ((aux_var.get_type() == AuxVarType::diffLag || aux_var.get_type() == AuxVarType::diffLead)
&& aux_var.get_symb_id() == diff_aux_var_symb_id)
lag += 1 + getOrigLeadLagForDiffAuxVar(aux_var.get_orig_symb_id());
return lag;
return (aux_var.get_type() == AuxVarType::diffLag ? 1 : -1) + getOrigLeadLagForDiffAuxVar(aux_var.get_orig_symb_id());
return 0;
}
int