core: add UintCodeType::Limites{Zeroes,Ones} for clarity
authorKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 17 Aug 2019 16:39:14 +0000 (18:39 +0200)
committerKostya Shishkov <kostya.shishkov@gmail.com>
Sat, 17 Aug 2019 16:39:14 +0000 (18:39 +0200)
nihav-core/src/io/intcode.rs

index 1c52d81efb3cad72fabce801a7937262eb57cdb0..a8437e8afeb7663ab0a98fada140eb3e108ad964 100644 (file)
@@ -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),