~tmpod/toasty-lc3-vm

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Remove small optimization when parsing the input instruction. Any instructions following INP were being ignored.

Details
Message ID
<20220801144212.8331-1-jpl@jpleite.eu>
DKIM signature
missing
Download raw message
Patch: +4 -4
---
 src/ir.rs | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ir.rs b/src/ir.rs
index 4ae3518..3ee6ad8 100644
--- a/src/ir.rs
+++ b/src/ir.rs
@@ -57,10 +57,10 @@ impl BrainfuckIR {
                }
            };

            // Tiny optimization I suppose
            if let Some(BrainfuckInstruction::INP) = instructions.last() {
                continue;
            }
            // // Tiny optimization I suppose
            // if let Some(BrainfuckInstruction::INP) = instructions.last() {
            //     continue;
            // }

            instructions.push(inst);
        }
-- 
2.37.1

Not quite sure what the optimization was meant to be, but this blocked any further
instructions from being parsed.
Details
Message ID
<CLURXV4WXDKR.2HP4WJUNVGJ1T@fusion>
In-Reply-To
<20220801144212.8331-1-jpl@jpleite.eu> (view parent)
DKIM signature
missing
Download raw message
Well, that's embarassing .-.
The idea was to drop multiple successive input instructions (",") as they
serve no purpose and are effectively "expensive" calls. Since you're
not moving the cell pointer inbetween inputs, you're just overwriting the
same thing.
Now that I think more about it though, you *may* want to really have
consecutive input calls, seeing as they block and may be useful in some
circumstances.
I suppose it's better to just drop that altogether; just delete it.
Reply to thread Export thread (mbox)