MCPcopy Create free account
hub / github.com/AxlLind/AdventOfCode / eval_term

Function eval_term

2020/src/bin/18.rs:47–54  ·  view source on GitHub ↗
(s: &[u8])

Source from the content-addressed store, hash-verified

45}
46
47fn eval_term(s: &[u8]) -> (usize, usize) {
48 if s[0] == b'(' {
49 let j = find_matching_par(s);
50 (eval_p2(&s[1..j]), j)
51 } else {
52 ((s[0] - b'0') as usize, 0)
53 }
54}
55
56fn eval_p2(s: &[u8]) -> usize {
57 let (mut val, mut i) = (1,0);

Callers 1

eval_p2Function · 0.85

Calls 2

find_matching_parFunction · 0.85
eval_p2Function · 0.85

Tested by

no test coverage detected