From a3fca07d87a2d057657af9bb79de9f595e4b1a10 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 17 Nov 2023 21:22:37 -0500 Subject: fix aligned and doublecell ops --- libalee/corewords.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libalee') diff --git a/libalee/corewords.cpp b/libalee/corewords.cpp index 8ff7ac6..292e3cf 100644 --- a/libalee/corewords.cpp +++ b/libalee/corewords.cpp @@ -147,17 +147,17 @@ void CoreWords::word_sub(State& state) { } void CoreWords::word_mul(State& state) { // ( n n -- d ) auto cell = state.pop(); - auto dcell = state.pop() * cell; + auto dcell = (DoubleCell)state.pop() * cell; pushd(state, dcell); } void CoreWords::word_div(State& state) { // ( d n -- n ) auto cell = state.pop(); - auto dcell = popd(state); + auto dcell = (DoubleCell)popd(state); state.push(static_cast(dcell / cell)); } void CoreWords::word_mod(State& state) { // ( d n -- n ) auto cell = state.pop(); - auto dcell = popd(state); + auto dcell = (DoubleCell)popd(state); state.push(static_cast(dcell % cell)); } void CoreWords::word_peek(State& state) { // ( addr cell? -- n ) @@ -233,7 +233,7 @@ void CoreWords::word_semic(State& state) { // Concludes word definition. state.compiling(false); auto cell = state.pop(); - auto dcell = cell - state.dict.latest(); + auto dcell = (DoubleCell)cell - state.dict.latest(); if (dcell >= Dictionary::MaxDistance) { // Large distance to previous entry: store in dedicated cell. state.dict.write(static_cast(cell) + sizeof(Cell), -- cgit v1.2.3