From 40797972f3dd51733a346d1952833e9c18f82379 Mon Sep 17 00:00:00 2001 From: Rowan Torbitzky-Lane Date: Sun, 19 Jan 2025 21:56:17 -0600 Subject: [PATCH] int/bool instructions --- src/Instructions/IntInstructions.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Instructions/IntInstructions.hs b/src/Instructions/IntInstructions.hs index 8564967..bdbc783 100644 --- a/src/Instructions/IntInstructions.hs +++ b/src/Instructions/IntInstructions.hs @@ -4,6 +4,14 @@ import State import Instructions.GenericInstructions -- import Debug.Trace +instructionIntFromFloat :: State -> State +instructionIntFromFloat state@(State {_float = (f : fs), _int = is}) = state {_float = fs, _int = floor f : is} +instructionIntFromFloat state = state + +instructionIntFromBool :: State -> State +instructionIntFromBool state@(State {_bool = (b : bs), _int = is}) = state {_bool = bs, _int = (if b then 1 else 0) : is} +instructionIntFromBool state = state + instructionIntAdd :: State -> State instructionIntAdd state@(State {_int = (i1 : i2 : is)}) = state {_int = i2 + i1 : is} instructionIntAdd state = state