From: Kostya Shishkov Date: Sat, 13 Oct 2018 10:14:18 +0000 (+0200) Subject: fix limited unary code invocation parameters X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=8f879477a67056bb61a0d1cc8e240b6980d41286;p=nihav.git fix limited unary code invocation parameters --- 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 { } } -fn read_unary_lim(br: &mut BitReader, terminator: u32, len: u32) -> BitReaderResult { +fn read_unary_lim(br: &mut BitReader, len: u32, terminator: u32) -> BitReaderResult { 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),