Merge shared code in hashing.
This commit is contained in:
@ -14,4 +14,29 @@
|
||||
|
||||
internals vocabulary hashing hashing definitions
|
||||
|
||||
0 VALUE h0 0 VALUE h1 0 VALUE h2 0 VALUE h3
|
||||
0 VALUE h4 0 VALUE h5 0 VALUE h6 0 VALUE h7
|
||||
0 VALUE a 0 VALUE b 0 VALUE c 0 VALUE d
|
||||
0 VALUE e 0 VALUE f 0 VALUE g 0 VALUE h
|
||||
0 VALUE temp1 0 VALUE temp2
|
||||
|
||||
CREATE w 80 4* ALLOT
|
||||
: w@ ( n -- n ) 4* w + UL@ ;
|
||||
: w! ( n n -- ) 4* w + L! ;
|
||||
|
||||
: 32-bit ( n -- n ) $ffffffff AND ;
|
||||
: L+ ( n n -- n ) + 32-bit ;
|
||||
: L, ( n -- ) HERE L! 4 ALLOT ;
|
||||
|
||||
: <<< ( n n -- n ) 2DUP LSHIFT -ROT 32 SWAP - RSHIFT OR 32-bit ;
|
||||
: >>> ( n n -- n ) 2DUP RSHIFT -ROT 32 SWAP - LSHIFT OR 32-bit ;
|
||||
|
||||
VARIABLE ends
|
||||
: <-> ( n - n ) ends ! 0 4 0 DO 8 LSHIFT ends I + C@ OR LOOP ;
|
||||
: <->* ( a n -- ) 0 ?DO DUP UL@ <-> OVER L! 4 + LOOP DROP ;
|
||||
|
||||
: >dig ( a n -- a )
|
||||
BASE @ >R HEX <# # # # # # # # # #> R> BASE !
|
||||
ROT 2DUP + >R SWAP CMOVE R> ;
|
||||
|
||||
only forth definitions
|
||||
|
||||
Reference in New Issue
Block a user