//RouteSperge.bcpl

// Code for combining x-y pairs.

//
last modified by E. McCreight, June 25, 1981 4:38 PM

get "route.defs"

//----------------------------------------------------------------
//
C o - o r d i n a t e S p e r g i n g O p e r a t i o n s
//----------------------------------------------------------------

let Sperge(x, y, pFine; numargs na) = valof
[
if na gr 2 then @pFine = (x&3 lshift 2)+(y&3)
resultis (Spread(x rshift 2) lshift 1)+Spread(y rshift 2)
]

and Spread(x) = valof
[ // x must be < #400
let x1 = ((xŨ) lshift 4)+(x)
let x2 = ((x1᝾) lshift 2)+(x1ջ)
resultis ((x2刲) lshift 1)+(x2⢵)
]