diff options
Diffstat (limited to 'linux/advent2020')
-rw-r--r-- | linux/advent2020/2a.mu | 6 | ||||
-rw-r--r-- | linux/advent2020/2b.mu | 6 | ||||
-rw-r--r-- | linux/advent2020/4b.mu | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/linux/advent2020/2a.mu b/linux/advent2020/2a.mu index 4492e7ea..ce678eb8 100644 --- a/linux/advent2020/2a.mu +++ b/linux/advent2020/2a.mu @@ -46,8 +46,8 @@ fn main -> _/ebx: int { } skip-chars-matching-whitespace line # now check the rest of the line - var is-valid?/eax: boolean <- is-valid? start, end, letter, line - compare is-valid?, 0/false + var valid?/eax: boolean <- valid? start, end, letter, line + compare valid?, 0/false { break-if-= print-string 0, "valid!\n" @@ -60,7 +60,7 @@ fn main -> _/ebx: int { return 0 } -fn is-valid? start: int, end: int, letter: byte, password: (addr stream byte) -> _/eax: boolean { +fn valid? start: int, end: int, letter: byte, password: (addr stream byte) -> _/eax: boolean { var letter-count/edi: int <- copy 0 # for every c in password # if (c == letter) diff --git a/linux/advent2020/2b.mu b/linux/advent2020/2b.mu index f228b451..121e9dfa 100644 --- a/linux/advent2020/2b.mu +++ b/linux/advent2020/2b.mu @@ -52,8 +52,8 @@ fn main -> _/ebx: int { } skip-chars-matching-whitespace line # now check the rest of the line - var is-valid?/eax: boolean <- is-valid? pos1, pos2, letter, line - compare is-valid?, 0/false + var valid?/eax: boolean <- valid? pos1, pos2, letter, line + compare valid?, 0/false { break-if-= print-string 0, "valid!\n" @@ -69,7 +69,7 @@ fn main -> _/ebx: int { # ideally password would be a random-access array # we'll just track an index # one benefit: we can easily start at 1 -fn is-valid? pos1: int, pos2: int, letter: byte, password: (addr stream byte) -> _/eax: boolean { +fn valid? pos1: int, pos2: int, letter: byte, password: (addr stream byte) -> _/eax: boolean { var i/esi: int <- copy 1 var letter-count/edi: int <- copy 0 # while password stream isn't empty diff --git a/linux/advent2020/4b.mu b/linux/advent2020/4b.mu index 00e99eeb..2dc6c6a2 100644 --- a/linux/advent2020/4b.mu +++ b/linux/advent2020/4b.mu @@ -231,7 +231,7 @@ fn main -> _/ebx: int { var c/eax: (addr byte) <- index s3, i { var c2/eax: byte <- copy-byte *c - var valid?/eax: boolean <- is-hex-digit? c2 + var valid?/eax: boolean <- hex-digit? c2 compare valid?, 0 loop-if-= $main:word-loop } |