[gforth] / gforth / asm / bitmask2.fs  

gforth: gforth/asm/bitmask2.fs

Diff for /gforth/asm/bitmask2.fs between version 1.1 and 1.2

version 1.1, Sat May 8 10:39:50 2010 UTC version 1.2, Sat May 8 10:50:44 2010 UTC
Line 42 
Line 42 
       then        then
    loop     loop
    swap 0<> ABORT" dispense: value does not fit into masked bits" ;     swap 0<> ABORT" dispense: value does not fit into masked bits" ;
 : embed  ( x1-accu x2-val x3-mask -- x4-result )  : embed  ( x2-val x1-accu x3-mask -- x4-result )
    \ encode 'val' into bits set given by mask, replacing corresponding bits in     \ encode 'val' into bits given by mask, replacing these bits in 'accu'
    \ 'accu'     tuck invert and -rot      \ delete corresponding bits in accu
    dup >r dispense         \ dispense value over masked bits     dispense  or ;            \ dispense value over masked bits, onto accu ;
    swap r> invert and      \ delete corresponding bits in accu  
    or ;                    \ and add dispensed bits  
   
 : mask ( +n -- mask )  \ get bitmask for lowest #n bits  : mask ( +n -- mask )  \ get bitmask for lowest #n bits
    0 invert  swap lshift invert ;     0 invert  swap lshift invert ;
Line 61 
Line 59 
   
 : maskinto ( "x-mask" --  runtime:  x1-val x1-accu -- x2-masked )  : maskinto ( "x-mask" --  runtime:  x1-val x1-accu -- x2-masked )
    \ for backwards compatability with old bitmask code     \ for backwards compatability with old bitmask code
     ]] swap [[ parse-word s>number drop ]]L embed [[ ; IMMEDIATE      parse-word s>number drop ]]L embed [[ ; IMMEDIATE


Generate output suitable for use with a patch program
Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

CVS Admin

Powered by ViewCVS 1.0-dev
(Powered by ViewCVS)

ViewCVS and CVS Help