0 | ||| Ordered Nat Priority Search Queue Internals
7 | %language ElabReflection
9 | --------------------------------------------------------------------------------
10 | -- Internal Utility
11 | --------------------------------------------------------------------------------
13 | ||| Convenience interface for bitSize that doesn't use an implicit parameter.
14 | private
21 | --------------------------------------------------------------------------------
22 | -- Internals
23 | --------------------------------------------------------------------------------
25 | ||| Size is a natural machine word
26 | ||| (Bits32/Bits64 or the size of an unsigned Int on the host system).
32 | Bits32
34 | Bits64
36 | ||| The Nat type are keys for the queue (Ordered Nat Priority Search Queue).
41 | ||| We store Masks as the index of the bit that determines the branching.
46 | --------------------------------------------------------------------------------
47 | -- Bit Manipulation
48 | --------------------------------------------------------------------------------
50 | private
54 | cast
56 | private
60 | cast
62 | export
69 | private
75 | export
82 | where
85 | private
96 | x6
101 | export
108 | --------------------------------------------------------------------------------
109 | -- NatPSQ
110 | --------------------------------------------------------------------------------
112 | ||| A priority search queue with Nat keys
113 | ||| and priorities of type p and values of type v.
114 | ||| Many operations have a worst-case complexity of O(min(n,W)).
115 | ||| This means that the operation can become linear in the number of elements with a maximum of W
116 | ||| (the number of bits in an Int (32 or 64)).
117 | ||| It is generally much faster than an OrdPSQ.