diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2018-10-13 12:14:18 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2018-10-13 12:14:18 +0200 |
commit | 8f879477a67056bb61a0d1cc8e240b6980d41286 (patch) | |
tree | 000c2c2e6bd04266c287e57d65399793d0bfa152 /src | |
parent | 594ca5ca67fa9a7f47cac589925d8aa5106e3f7b (diff) | |
download | nihav-8f879477a67056bb61a0d1cc8e240b6980d41286.tar.gz |
fix limited unary code invocation parameters
Diffstat (limited to 'src')
-rw-r--r-- | src/io/intcode.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/io/intcode.rs b/src/io/intcode.rs index e876772..a898a10 100644 --- a/src/io/intcode.rs +++ b/src/io/intcode.rs @@ -33,7 +33,7 @@ fn read_unary(br: &mut BitReader, terminator: u32) -> BitReaderResult<u32> { } } -fn read_unary_lim(br: &mut BitReader, terminator: u32, len: u32) -> BitReaderResult<u32> { +fn read_unary_lim(br: &mut BitReader, len: u32, terminator: u32) -> BitReaderResult<u32> { let mut res: u32 = 0; loop { if br.read(1)? == terminator { return Ok(res); } @@ -101,7 +101,7 @@ impl<'a> IntCodeReader for BitReader<'a> { match t { UintCodeType::UnaryOnes => read_unary(self, 0), UintCodeType::UnaryZeroes => read_unary(self, 1), - UintCodeType::LimitedUnary(len, term) => read_unary_lim(self, term, len), + UintCodeType::LimitedUnary(len, term) => read_unary_lim(self, len, term), UintCodeType::Unary012 => read_unary_lim(self, 2, 0), UintCodeType::Unary210 => read_unary210(self), UintCodeType::Golomb(m) => read_golomb(self, m), |