MCPcopy Create free account
hub / github.com/ElementsProject/elements / enumerator

Function enumerator

src/simplicity/dag.h:45–68  ·  view source on GitHub ↗

Given a tag for an expression, add it to the 'census'. */

Source from the content-addressed store, hash-verified

43/* Given a tag for an expression, add it to the 'census'.
44 */
45static inline void enumerator(combinator_counters* census, tag_t tag) {
46 if (!census) return;
47 switch (tag) {
48 case COMP: census->comp_cnt++; return;
49 case ASSERTL:
50 case ASSERTR: /* Assertions are counted as CASE combinators. */
51 case CASE: census->case_cnt++; return;
52 case PAIR: census->pair_cnt++; return;
53 case DISCONNECT: census->disconnect_cnt++; return;
54 case INJL: census->injl_cnt++; return;
55 case INJR: census->injr_cnt++; return;
56 case TAKE: census->take_cnt++; return;
57 case DROP: census->drop_cnt++; return;
58
59 /* These tags are not accounted for in the census. */
60 case IDEN:
61 case UNIT:
62 case HIDDEN:
63 case WITNESS:
64 case JET:
65 case WORD:
66 return;
67 }
68}
69
70/* Returns the number of children that a Simplicity combinator of the 'tag' kind has.
71 */

Callers 1

decodeDagFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected