: j postpone 2r> ['] r> , postpone r@ ['] swap ,
['] >r , ['] -rot , postpone 2>r ; imm
-: aligned dup [ 1 cells 1- ] literal swap over & if [ 1 cells ] literal
- swap - + else drop then ;
-: align here dup aligned swap - allot ;
-
: and & ;
: or | ;
: xor ^ ;
: _msb [ 1 1 cells 8 * 1- << ] literal ;
: 2/ dup 1 >> swap 0< if _msb or then ;
+: aligned [ 1 cells 1- ] literal swap over + swap invert and ;
+: align here dup aligned swap - allot ;
+
: /mod 2dup % -rot / ;
: */ >r m* r> _/ ;
: sm/rem >r 2dup r@ _% -rot r> _/ ;
dup _isdigit - _uma
r> char+ r> 1- repeat ;
-: <# 40 here c! ;
-: #> 2drop here dup c@ + 40 here c@ - ;
+: <# [ 20 cells ] literal here c! ;
+: #> 2drop here dup c@ + [ 20 cells ] literal here c@ - ;
: hold -1 here +! here dup c@ + c! ;
: # base @
>r 0 i um/mod r> swap >r um/mod r>
}
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<Cell>(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<Cell>(dcell % cell));
}
void CoreWords::word_peek(State& state) { // ( addr cell? -- n )
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<Addr>(cell) + sizeof(Cell),