projects
/
nihav.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
594ca5c
)
fix limited unary code invocation parameters
author
Kostya Shishkov
<kostya.shishkov@gmail.com>
Sat, 13 Oct 2018 10:14:18 +0000
(12:14 +0200)
committer
Kostya Shishkov
<kostya.shishkov@gmail.com>
Sat, 13 Oct 2018 10:14:18 +0000
(12:14 +0200)
src/io/intcode.rs
patch
|
blob
|
blame
|
history
diff --git
a/src/io/intcode.rs
b/src/io/intcode.rs
index e876772df8d320e4ffe539d2278b4d9ea3c13a53..a898a10444415dd419f90a940996c64cabbb29ac 100644
(file)
--- 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); }
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),
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),
UintCodeType::Unary012 => read_unary_lim(self, 2, 0),
UintCodeType::Unary210 => read_unary210(self),
UintCodeType::Golomb(m) => read_golomb(self, m),