diff --git a/src/spicelib/devices/csw/cswacld.c b/src/spicelib/devices/csw/cswacld.c index 6fb290052..9b2379358 100644 --- a/src/spicelib/devices/csw/cswacld.c +++ b/src/spicelib/devices/csw/cswacld.c @@ -34,7 +34,7 @@ CSWacLoad(GENmodel *inModel, CKTcircuit *ckt) current_state = (int) ckt->CKTstates[0][here->CSWstate + 0]; - g_now = current_state?(model->CSWonConduct):(model->CSWoffConduct); + g_now = current_state ? model->CSWonConduct : model->CSWoffConduct; *(here->CSWposPosPtr) += g_now; *(here->CSWposNegPtr) -= g_now; diff --git a/src/spicelib/devices/csw/cswload.c b/src/spicelib/devices/csw/cswload.c index ac12d49c2..4e36e0a73 100644 --- a/src/spicelib/devices/csw/cswload.c +++ b/src/spicelib/devices/csw/cswload.c @@ -47,16 +47,16 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) if(here->CSWzero_stateGiven) { /* switch specified "on" */ - if ((model->CSWiHysteresis >= 0) && (i_ctrl > (model->CSWiThreshold + model->CSWiHysteresis))) + if (model->CSWiHysteresis >= 0 && i_ctrl > model->CSWiThreshold + model->CSWiHysteresis) current_state = REALLY_ON; - else if ((model->CSWiHysteresis < 0) && (i_ctrl > (model->CSWiThreshold - model->CSWiHysteresis))) + else if (model->CSWiHysteresis < 0 && i_ctrl > model->CSWiThreshold - model->CSWiHysteresis) current_state = REALLY_ON; else current_state = HYST_ON; } else { - if ((model->CSWiHysteresis >= 0) && (i_ctrl < (model->CSWiThreshold - model->CSWiHysteresis))) + if (model->CSWiHysteresis >= 0 && i_ctrl < model->CSWiThreshold - model->CSWiHysteresis) current_state = REALLY_OFF; - else if ((model->CSWiHysteresis < 0) && (i_ctrl < (model->CSWiThreshold + model->CSWiHysteresis))) + else if (model->CSWiHysteresis < 0 && i_ctrl < model->CSWiThreshold + model->CSWiHysteresis) current_state = REALLY_OFF; else current_state = HYST_OFF; @@ -86,7 +86,7 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) * or from hi to hysteresis. */ /* if previous state was in hysteresis, then don't change the state.. */ - if ((previous_state == HYST_OFF) || (previous_state == HYST_ON)) + if (previous_state == HYST_OFF || previous_state == HYST_ON) current_state = previous_state; else if (previous_state == REALLY_ON) current_state = HYST_OFF; @@ -121,7 +121,7 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) * or from hi to hysteresis. */ /* if previous state was in hysteresis, then don't change the state.. */ - if ((previous_state == HYST_OFF) || (previous_state == HYST_ON)) + if (previous_state == HYST_OFF || previous_state == HYST_ON) current_state = previous_state; else if (previous_state == REALLY_ON) current_state = HYST_OFF; @@ -135,7 +135,7 @@ CSWload(GENmodel *inModel, CKTcircuit *ckt) ckt->CKTstates[0][here->CSWstate + 0] = current_state; ckt->CKTstates[1][here->CSWstate + 0] = previous_state; - if ((current_state == REALLY_ON) || (current_state == HYST_ON)) + if (current_state == REALLY_ON || current_state == HYST_ON) g_now = model->CSWonConduct; else g_now = model->CSWoffConduct; diff --git a/src/spicelib/devices/csw/cswmpar.c b/src/spicelib/devices/csw/cswmpar.c index 35fe7ebff..056dc8549 100644 --- a/src/spicelib/devices/csw/cswmpar.c +++ b/src/spicelib/devices/csw/cswmpar.c @@ -23,12 +23,12 @@ CSWmParam(int param, IFvalue *value, GENmodel *inModel) break; case CSW_RON: model->CSWonResistance = value->rValue; - model->CSWonConduct = 1.0/(value->rValue); + model->CSWonConduct = 1.0/value->rValue; model->CSWonGiven = TRUE; break; case CSW_ROFF: model->CSWoffResistance = value->rValue; - model->CSWoffConduct = 1.0/(value->rValue); + model->CSWoffConduct = 1.0/value->rValue; model->CSWoffGiven = TRUE; break; case CSW_ITH: diff --git a/src/spicelib/devices/csw/cswnoise.c b/src/spicelib/devices/csw/cswnoise.c index 6c08061f0..98edc8ec1 100644 --- a/src/spicelib/devices/csw/cswnoise.c +++ b/src/spicelib/devices/csw/cswnoise.c @@ -67,7 +67,7 @@ CSWnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *d current_state = (int) ckt->CKTstates[0][inst->CSWstate + 0]; NevalSrc(&noizDens,&lnNdens,ckt,THERMNOISE, inst->CSWposNode,inst->CSWnegNode, - current_state?(model->CSWonConduct):(model->CSWoffConduct)); + current_state ? model->CSWonConduct : model->CSWoffConduct); *OnDens += noizDens; diff --git a/src/spicelib/devices/csw/cswpzld.c b/src/spicelib/devices/csw/cswpzld.c index b6a39819a..7fcafc658 100644 --- a/src/spicelib/devices/csw/cswpzld.c +++ b/src/spicelib/devices/csw/cswpzld.c @@ -38,7 +38,7 @@ CSWpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) current_state = (int) ckt->CKTstates[0][here->CSWstate + 0]; - g_now = current_state?(model->CSWonConduct):(model->CSWoffConduct); + g_now = current_state ? model->CSWonConduct : model->CSWoffConduct; *(here->CSWposPosPtr) += g_now; *(here->CSWposNegPtr) -= g_now; diff --git a/src/spicelib/devices/csw/cswtrunc.c b/src/spicelib/devices/csw/cswtrunc.c index 0e9b670b9..e11d017f2 100644 --- a/src/spicelib/devices/csw/cswtrunc.c +++ b/src/spicelib/devices/csw/cswtrunc.c @@ -27,16 +27,16 @@ CSWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) lastChange = ckt->CKTstates[0][here->CSWstate + 1] - ckt->CKTstates[1][here->CSWstate + 1]; if (ckt->CKTstates[0][here->CSWstate + 0]==0) { - ref = (model->CSWiThreshold + model->CSWiHysteresis); - if ((ckt->CKTstates[0][here->CSWstate + 1]0)) { + ref = model->CSWiThreshold + model->CSWiHysteresis; + if (ckt->CKTstates[0][here->CSWstate + 1]0) { maxChange = (ref - ckt->CKTstates[0][here->CSWstate + 1]) * 0.75 + 0.00005; maxStep = maxChange/lastChange * ckt->CKTdeltaOld[0]; if (*timeStep > maxStep) *timeStep = maxStep; } } else { - ref = (model->CSWiThreshold - model->CSWiHysteresis); - if ((ckt->CKTstates[0][here->CSWstate + 1]>ref) && (lastChange<0)) { + ref = model->CSWiThreshold - model->CSWiHysteresis; + if (ckt->CKTstates[0][here->CSWstate + 1]>ref && lastChange<0) { maxChange = (ref - ckt->CKTstates[0][here->CSWstate + 1]) * 0.75 - 0.00005; maxStep = maxChange/lastChange * ckt->CKTdeltaOld[0]; diff --git a/src/spicelib/devices/sw/swacload.c b/src/spicelib/devices/sw/swacload.c index 7d92f94d1..ad7c6638d 100644 --- a/src/spicelib/devices/sw/swacload.c +++ b/src/spicelib/devices/sw/swacload.c @@ -35,7 +35,7 @@ SWacLoad(GENmodel *inModel, CKTcircuit *ckt) current_state = (int) ckt->CKTstates[0][here->SWstate + 0]; - g_now = current_state?(model->SWonConduct):(model->SWoffConduct); + g_now = current_state ? model->SWonConduct : model->SWoffConduct; *(here->SWposPosPtr) += g_now; *(here->SWposNegPtr) -= g_now; diff --git a/src/spicelib/devices/sw/swload.c b/src/spicelib/devices/sw/swload.c index 837c2ca3e..7840148d8 100644 --- a/src/spicelib/devices/sw/swload.c +++ b/src/spicelib/devices/sw/swload.c @@ -49,16 +49,16 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) if(here->SWzero_stateGiven) { /* switch specified "on" */ - if ((model->SWvHysteresis >= 0) && (v_ctrl > (model->SWvThreshold + model->SWvHysteresis))) + if (model->SWvHysteresis >= 0 && v_ctrl > model->SWvThreshold + model->SWvHysteresis) current_state = REALLY_ON; - else if ((model->SWvHysteresis < 0) && (v_ctrl > (model->SWvThreshold - model->SWvHysteresis))) + else if (model->SWvHysteresis < 0 && v_ctrl > model->SWvThreshold - model->SWvHysteresis) current_state = REALLY_ON; else current_state = HYST_ON; } else { - if ((model->SWvHysteresis >= 0) && (v_ctrl < (model->SWvThreshold - model->SWvHysteresis))) + if (model->SWvHysteresis >= 0 && v_ctrl < model->SWvThreshold - model->SWvHysteresis) current_state = REALLY_OFF; - else if ((model->SWvHysteresis < 0) && (v_ctrl < (model->SWvThreshold + model->SWvHysteresis))) + else if (model->SWvHysteresis < 0 && v_ctrl < model->SWvThreshold + model->SWvHysteresis) current_state = REALLY_OFF; else current_state = HYST_OFF; @@ -85,7 +85,7 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) current_state = REALLY_OFF; else { // in hysteresis... change value if going from low to hysteresis, or from hi to hysteresis. // if previous state was in hysteresis, then don't change the state.. - if ((previous_state == HYST_OFF) || (previous_state == HYST_ON)) + if (previous_state == HYST_OFF || previous_state == HYST_ON) current_state = previous_state; else if (previous_state == REALLY_ON) current_state = HYST_OFF; @@ -118,7 +118,7 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) current_state = REALLY_OFF; else { current_state = 0.0; - if ((previous_state == HYST_ON) || (previous_state == HYST_OFF)) + if (previous_state == HYST_ON || previous_state == HYST_OFF) current_state = previous_state; else if (previous_state == REALLY_ON) current_state = REALLY_OFF; @@ -136,7 +136,7 @@ SWload(GENmodel *inModel, CKTcircuit *ckt) ckt->CKTstates[0][here->SWstate + 0] = current_state; ckt->CKTstates[0][here->SWstate + 1] = v_ctrl; - if ((current_state == REALLY_ON) || (current_state == HYST_ON)) + if (current_state == REALLY_ON || current_state == HYST_ON) g_now = model->SWonConduct; else g_now = model->SWoffConduct; diff --git a/src/spicelib/devices/sw/swmparam.c b/src/spicelib/devices/sw/swmparam.c index 7f7030f35..3d49e9b3a 100644 --- a/src/spicelib/devices/sw/swmparam.c +++ b/src/spicelib/devices/sw/swmparam.c @@ -23,12 +23,12 @@ SWmParam(int param, IFvalue *value, GENmodel *inModel) break; case SW_MOD_RON: model->SWonResistance = value->rValue; - model->SWonConduct = 1.0/(value->rValue); + model->SWonConduct = 1.0/value->rValue; model->SWonGiven = TRUE; break; case SW_MOD_ROFF: model->SWoffResistance = value->rValue; - model->SWoffConduct = 1.0/(value->rValue); + model->SWoffConduct = 1.0/value->rValue; model->SWoffGiven = TRUE; break; case SW_MOD_VTH: diff --git a/src/spicelib/devices/sw/swnoise.c b/src/spicelib/devices/sw/swnoise.c index e1d0a015f..f0b0facde 100644 --- a/src/spicelib/devices/sw/swnoise.c +++ b/src/spicelib/devices/sw/swnoise.c @@ -67,7 +67,7 @@ SWnoise (int mode, int operation, GENmodel *genmodel, CKTcircuit *ckt, Ndata *da current_state = (int) ckt->CKTstates[0][inst->SWstate + 0]; NevalSrc(&noizDens,&lnNdens,ckt,THERMNOISE, inst->SWposNode,inst->SWnegNode, - current_state?(model->SWonConduct):(model->SWoffConduct)); + current_state ? model->SWonConduct : model->SWoffConduct); *OnDens += noizDens; diff --git a/src/spicelib/devices/sw/swpzload.c b/src/spicelib/devices/sw/swpzload.c index e2027263c..b936d7c89 100644 --- a/src/spicelib/devices/sw/swpzload.c +++ b/src/spicelib/devices/sw/swpzload.c @@ -39,7 +39,7 @@ SWpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s) current_state = (int) ckt->CKTstates[0][here->SWstate + 0]; - g_now = current_state?(model->SWonConduct):(model->SWoffConduct); + g_now = current_state ? model->SWonConduct : model->SWoffConduct; *(here->SWposPosPtr) += g_now; *(here->SWposNegPtr) -= g_now; diff --git a/src/spicelib/devices/sw/swtrunc.c b/src/spicelib/devices/sw/swtrunc.c index 49890e0dc..2da6f43ed 100644 --- a/src/spicelib/devices/sw/swtrunc.c +++ b/src/spicelib/devices/sw/swtrunc.c @@ -25,16 +25,16 @@ SWtrunc(GENmodel *inModel, CKTcircuit *ckt, double *timeStep) lastChange = ckt->CKTstates[0][here->SWstate + 1] - ckt->CKTstates[1][here->SWstate + 1]; if (ckt->CKTstates[0][here->SWstate + 0]==0) { - ref = (model->SWvThreshold + model->SWvHysteresis); - if ((ckt->CKTstates[0][here->SWstate + 1]0)) { + ref = model->SWvThreshold + model->SWvHysteresis; + if (ckt->CKTstates[0][here->SWstate + 1]0) { maxChange = (ref - ckt->CKTstates[0][here->SWstate + 1]) * 0.75 + 0.05; maxStep = maxChange/lastChange * ckt->CKTdeltaOld[0]; if (*timeStep > maxStep) *timeStep = maxStep; } } else { - ref = (model->SWvThreshold - model->SWvHysteresis); - if ((ckt->CKTstates[0][here->SWstate + 1]>ref) && (lastChange<0)) { + ref = model->SWvThreshold - model->SWvHysteresis; + if (ckt->CKTstates[0][here->SWstate + 1]>ref && lastChange<0) { maxChange = (ref - ckt->CKTstates[0][here->SWstate + 1]) * 0.75 - 0.05; maxStep = maxChange/lastChange * ckt->CKTdeltaOld[0];