From 576e522d384f815f2805b03506dbf25672b020d0 Mon Sep 17 00:00:00 2001 From: rlar Date: Sat, 18 Mar 2017 19:49:13 +0100 Subject: [PATCH] inp2m.c, #6/7, reorder code --- src/spicelib/parser/inp2m.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/spicelib/parser/inp2m.c b/src/spicelib/parser/inp2m.c index 183fe1507..6de62fa4d 100644 --- a/src/spicelib/parser/inp2m.c +++ b/src/spicelib/parser/inp2m.c @@ -91,13 +91,14 @@ INP2M(CKTcircuit *ckt, INPtables *tab, card *current) INPtermInsert(ckt, &token, tab, &node[i]); } - numnodes = i; - - if (numnodes > model_numnodes(thismodel->INPmodType)) { + int model_numnodes_ = model_numnodes(thismodel->INPmodType); + if (i > model_numnodes_) { LITERR ("too much nodes connected to instance"); return; } + numnodes = i; + if (thismodel->INPmodType != INPtypelook("Mos1") && thismodel->INPmodType != INPtypelook("Mos2") && thismodel->INPmodType != INPtypelook("Mos3") && @@ -139,8 +140,6 @@ INP2M(CKTcircuit *ckt, INPtables *tab, card *current) IFC (newInstance, (ckt, mdfast, &fast, name)); - /* use type - not thismodel->INPmodType as it might not exist! */ - int model_numnodes_ = model_numnodes(type); for (i = 0; i < model_numnodes_; i++) if (i < numnodes) IFC (bindNode, (ckt, fast, i + 1, node[i]));