def cmp.go

bend-kit-bytes@0.3.3.0 · bytes.bend:586

import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import Base

586# Compares whole words; c is the previous pair's order.
587def cmp.go(n: Nat, c: Cmp, r: Array<U32> & U32, s: Array<U32> & U32, +i: U32) -> Array<U32> & Array<U32> & Cmp:
588  match n:
589    case 0n:
590      (x, v) = r
591      (y, w) = s
592      (x, y, c)
593    case 1n+p:
594      match c:
595        case LT{}:
596          (x, v) = r
597          (y, w) = s
598          (x, y, LT{})
599        case GT{}:
600          (x, v) = r
601          (y, w) = s
602          (x, y, GT{})
603        case EQ{}:
604          (x, +v) = r
605          (y, +w) = s
606          cmp.go(p, U32.cmp(bswap(v), bswap(w)), Array.get(U32, x, (i + 1 : U32)), Array.get(U32, y, (i + 1 : U32)), (i + 1 : U32))

Uses (10)

Used by (1)