aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2023-11-02 08:10:42 -0400
committerClyne Sullivan <clyne@bitgloo.com>2023-11-02 08:10:42 -0400
commit6dcf780a3b39e54127468af4682b3df480c4bdbd (patch)
tree6ff2c971e6354cb079f5fd7bc3ee362245af803c
parent6bd7338414be807a19d426fbc3b65b225df2d7ce (diff)
fix if condition on 16-bit cpus
-rw-r--r--libalee/corewords.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/libalee/corewords.cpp b/libalee/corewords.cpp
index 6900b45..8f903e1 100644
--- a/libalee/corewords.cpp
+++ b/libalee/corewords.cpp
@@ -178,14 +178,14 @@ execute:
state.compiling(false);
cell = state.pop();
- dcell = (cell - state.dict.latest()) << 6;
- if (dcell > (((1 << (sizeof(Cell) * 8 - 6)) - 1) << 6)) {
+ dcell = cell - state.dict.latest();
+ if (dcell > (1 << (sizeof(Cell) * 8 - 6)) - 1) {
state.dict.write(cell,
(state.dict.read(cell) & 0x1F) | static_cast<Cell>(((1 << (sizeof(Cell) * 8 - 6)) - 1) << 6));
- state.dict.write(static_cast<Addr>(cell) + sizeof(Cell), static_cast<Cell>(dcell >> 6));
+ state.dict.write(static_cast<Addr>(cell) + sizeof(Cell), static_cast<Cell>(dcell));
} else {
state.dict.write(cell,
- (state.dict.read(cell) & 0x1F) | static_cast<Cell>(dcell));
+ (state.dict.read(cell) & 0x1F) | static_cast<Cell>(dcell << 6));
}
state.dict.latest(cell);
break;