All pastes #117685 Raw Edit

Someone

public text v1 · immutable
·published 2006-08-06 01:49 UTC
rendered paste body
\ neal@quartus.net 2006

: 2nip ( a b c d -- c d )  2swap 2drop ;

: ud2/ ( ud1. -- ud2. )  
\ Shift an unsigned double-cell value one bit to the right.
  d2/ $7fffffff and ;

: ud8/ ( ud1. -- ud2. )
\ Shift an unsigned double-cell value three bits to the right.
  ud2/ ud2/ ud2/ ;

: um+ ( ud1. u -- ud2. )
\ Add an unsigned single-cell value to an unsigned double-cell value.
  0 d+ ;

: udm* ( ud. u -- ut.. )
\ Multiply an unsigned double-cell value by an unsigned single-cell value
\ to form a triple-cell product.
  tuck um*  2swap um*  2swap rot um+ ;

: ud* ( ud1. ud2. -- uq... )
\ Multiply two unsigned double-cell values to form a quadruple-cell product.
  2over rot udm*  2>r >r  udm*   r> um+  2r> rot um+ ;

: ud10/ ( ud1. -- ud2. )
\ Divide an unsigned double-cell value by 10 by multiplying by a reciprocal.
  $cccccccccccccccd. ud* .s 2nip ud8/ ;