From 3b89a4d7a39910f189ce7c918b23f496ed380e7e Mon Sep 17 00:00:00 2001 From: Kostya Shishkov Date: Sat, 17 Aug 2019 18:39:14 +0200 Subject: [PATCH] core: add UintCodeType::Limites{Zeroes,Ones} for clarity --- nihav-core/src/io/intcode.rs | 4 ++++ 1 file changed, 4 insertions(+) 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), -- 2.30.2