def CapBits.to_list
import bend-osdev-caps@0.1.0.0/caps.bend as Capsimport Base
240# the capabilities in s, in increasing order, numbered from k
241def CapBits.to_list(n: Nat, s: Word(n), +k: U32) -> List<&2, U32>:
242 match n:
243 case 0n:
244 Nil{}
245 case 1n+p:
246 match s:
247 case WCon{True{}, t}:
248 Con{k, CapBits.to_list(p, t, U32.add(k, 1))}
249 case WCon{False{}, t}:
250 CapBits.to_list(p, t, U32.add(k, 1))