From b0d04c9b28efc90bc6f1cfcc6d2c4d3e646099fb Mon Sep 17 00:00:00 2001
From: Ben Bridle <bridle.benjamin@gmail.com>
Date: Mon, 7 Oct 2024 19:48:12 +1300
Subject: Simplify conversion of Rust bool to Bedrock bool

The new subtract implementation should be a lot more efficient because
it avoids branching.
---
 src/processor.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/processor.rs b/src/processor.rs
index bc16f01..dc55e4b 100644
--- a/src/processor.rs
+++ b/src/processor.rs
@@ -27,8 +27,8 @@ impl <
         macro_rules! RPSH2  { ($x:expr,$y:expr)   => { WPSH1!($x); WPSH1!($y); }; }
         macro_rules! WPSHD  { ($d:expr)           => { self.wst.push_u16($d) }; }
         macro_rules! RPSHD  { ($d:expr)           => { self.rst.push_u16($d) }; }
-        macro_rules! WPSHB  { ($x:expr)           => { self.wst.push_u8(if $x {0xff} else {0x00}) }; }
-        macro_rules! RPSHB  { ($x:expr)           => { self.rst.push_u8(if $x {0xff} else {0x00}) }; }
+        macro_rules! WPSHB  { ($x:expr)           => { self.wst.push_u8(0u8.wrapping_sub($x as u8)) }; }
+        macro_rules! RPSHB  { ($x:expr)           => { self.rst.push_u8(0u8.wrapping_sub($x as u8)) }; }
 
         macro_rules! WPOP1  { ($x:ident)          => { let $x = self.wst.pop_u8();  }; }
         macro_rules! RPOP1  { ($x:ident)          => { let $x = self.rst.pop_u8();  }; }
-- 
cgit v1.2.3-70-g09d2