From: Kostya Shishkov Date: Sat, 17 Aug 2019 16:39:14 +0000 (+0200) Subject: core: add UintCodeType::Limites{Zeroes,Ones} for clarity X-Git-Url: https://git.nihav.org/?a=commitdiff_plain;h=3b89a4d7a39910f189ce7c918b23f496ed380e7e;p=nihav.git core: add UintCodeType::Limites{Zeroes,Ones} for clarity --- 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),