From c146e278fcdfb7b298d79379fe626566384eba49 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 22 Jun 1988 16:22:07 +0000 Subject: [PATCH] distance routine improved a little; still not safe! --- mach/proto/ncg/subr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mach/proto/ncg/subr.c b/mach/proto/ncg/subr.c index 957ac974b..addea1ff3 100644 --- a/mach/proto/ncg/subr.c +++ b/mach/proto/ncg/subr.c @@ -282,6 +282,7 @@ distance(cindex) { int tokexp,tpl; int expsize,toksize,exact; int xsekt=0; + int fromstackneeded=0; bp = &coderules[cindex]; #ifndef NDEBUG @@ -305,6 +306,7 @@ distance(cindex) { if (stackheight < tpl) { if (xsekt) return(MAXINT); + fromstackneeded = tpl - stackheight; tpl = stackheight; } else if (stackheight != tpl && xsekt==2) @@ -325,12 +327,12 @@ distance(cindex) { } else exact++; } - if (exact==tpl) { + if (exact==tpl && ! fromstackneeded) { if (xsekt) return(0); return(10-exact); } - return(20-exact); + return(20-exact+fromstackneeded); } unsigned costcalc(cost) cost_t cost; {