From 2c24381f9e553882848b4f9d906a86e038d56d47 Mon Sep 17 00:00:00 2001 From: Smaug123 <3138005+Smaug123@users.noreply.github.com> Date: Tue, 9 Sep 2025 07:08:52 +0100 Subject: [PATCH] More --- .woodpecker/build.yaml | 3 ++- sim_8086/src/assembly.rs | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.woodpecker/build.yaml b/.woodpecker/build.yaml index 37c2c4b..59be513 100644 --- a/.woodpecker/build.yaml +++ b/.woodpecker/build.yaml @@ -1,6 +1,6 @@ steps: build: - image: nixos/nix + image: nixos/nix:2.28.5 commands: - echo 'experimental-features = flakes nix-command' >> /etc/nix/nix.conf # Lint @@ -12,6 +12,7 @@ steps: - nix develop --command cargo test --verbose --release - nix develop --command cargo test --verbose # Run through Nix + - nix flake check - nix build - nix run . -- computer_enhance/perfaware/part1/listing_0038_many_register_mov computer_enhance/perfaware/part1/listing_0038_many_register_mov.asm - nix run . -- computer_enhance/perfaware/part1/listing_0055_challenge_rectangle computer_enhance/perfaware/part1/listing_0055_challenge_rectangle.asm diff --git a/sim_8086/src/assembly.rs b/sim_8086/src/assembly.rs index 5ef748f..5381cd3 100644 --- a/sim_8086/src/assembly.rs +++ b/sim_8086/src/assembly.rs @@ -202,10 +202,9 @@ fn literal_absolute_u8(input: &str) -> IResult<&str, u8> { Err(()) } }) - .fold(Ok(0u8), |acc, new| match (acc, new) { - (Ok(acc), Ok(new)) => Ok(acc * 16 + new), + .try_fold(0u8, |acc, new| match (acc, new) { (_, Err(())) => Err(()), - (Err(()), _) => Err(()), + (acc, Ok(new)) => Ok(acc * 16 + new), }) }), map_res(digit1, str::parse::), @@ -226,10 +225,9 @@ fn literal_absolute_u16(input: &str) -> IResult<&str, u16> { Err(()) } }) - .fold(Ok(0u16), |acc, new| match (acc, new) { - (Ok(acc), Ok(new)) => Ok(acc * 16 + new), + .try_fold(0u16, |acc, new| match (acc, new) { (_, Err(())) => Err(()), - (Err(()), _) => Err(()), + (acc, Ok(new)) => Ok(acc * 16 + new), }) }), map_res(digit1, str::parse::),