//routeArcLen.bcpl
// The memo-saving length routine used by the combinatorial
// and heuristic wire routers
//E. McCreight
//last edited by McCreight, June 25, 1981 3:07 PM
get "route.defs"
static
[ DistFn
memoTable = empty
]
let ArcLength(i, j) = valof
[ if i eq j then resultis 0
if i gr j then
[ let t = i; i = j; j = t ]// exchange i and j
let memoKey = (i lshift 8)+j
let memo = memoTable+
((memoKey rem memoTableEntries) lshift 1)
if memo>>MEMO.key eq memoKey then
resultis memo>>MEMO.value
memo>>MEMO.key = memoKey
let value = DistFn(X!i, Y!i, X!j, Y!j)
memo>>MEMO.value = value
resultis value
]