From 0810456e9c5c19a47511a682eeabc71008632a2c Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Thu, 9 Nov 2023 06:39:02 -0500 Subject: MaxDistance constant; some .cpp comments --- libalee/corewords.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libalee/corewords.cpp') diff --git a/libalee/corewords.cpp b/libalee/corewords.cpp index 534f1da..661590f 100644 --- a/libalee/corewords.cpp +++ b/libalee/corewords.cpp @@ -154,11 +154,11 @@ execute: cell = state.pop(); dcell = cell - state.dict.latest(); - if (dcell > (1 << (sizeof(Cell) * 8 - 6)) - 1) { + if (dcell >= Dictionary::MaxDistance) { // Large distance to previous entry: store in dedicated cell. state.dict.write(static_cast(cell) + sizeof(Cell), static_cast(dcell)); - dcell = ((1 << (sizeof(Cell) * 8 - 6)) - 1); + dcell = Dictionary::MaxDistance; } state.dict.write(cell, (state.dict.read(cell) & 0x1F) | static_cast(dcell << 6)); -- cgit v1.2.3