aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKostya Shishkov <kostya.shishkov@gmail.com>2019-08-17 18:39:14 +0200
committerKostya Shishkov <kostya.shishkov@gmail.com>2019-08-17 18:39:14 +0200
commit3b89a4d7a39910f189ce7c918b23f496ed380e7e (patch)
treea163fc007f3942bd689d876332d5b57e92fca47d
parent6350b1eea7d33fb87dae93c627ad8d3f6d644f9e (diff)
downloadnihav-3b89a4d7a39910f189ce7c918b23f496ed380e7e.tar.gz
core: add UintCodeType::Limites{Zeroes,Ones} for clarity
-rw-r--r--nihav-core/src/io/intcode.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/nihav-core/src/io/intcode.rs b/nihav-core/src/io/intcode.rs
index 1c52d81..a8437e8 100644
--- a/nihav-core/src/io/intcode.rs
+++ b/nihav-core/src/io/intcode.rs
@@ -7,6 +7,8 @@ pub enum UintCodeType {
Unary012,
Unary210,
LimitedUnary(u32, u32),
+ LimitedZeroes(u32),
+ LimitedOnes(u32),
Golomb(u8),
Rice(u8),
Gamma,
@@ -101,6 +103,8 @@ impl<'a> IntCodeReader for BitReader<'a> {
match t {
UintCodeType::UnaryOnes => read_unary(self, 0),
UintCodeType::UnaryZeroes => read_unary(self, 1),
+ UintCodeType::LimitedZeroes(len) => read_unary_lim(self, len, 1),
+ UintCodeType::LimitedOnes(len) => read_unary_lim(self, len, 0),
UintCodeType::LimitedUnary(len, term) => read_unary_lim(self, len, term),
UintCodeType::Unary012 => read_unary_lim(self, 2, 0),
UintCodeType::Unary210 => read_unary210(self),