2020-05-02 21:21:47 -04:00
|
|
|
: (parseb) ( a -- n f )
|
|
|
|
( '0': ASCII 0x30 'b': 0x62 0x6230: 25136 )
|
|
|
|
DUP @ 25136 = NOT IF 0 EXIT THEN ( a 0 )
|
|
|
|
( We have "0b" prefix )
|
2020-05-25 13:43:04 -04:00
|
|
|
DUP 1- C@ ( a len )
|
|
|
|
0 SWAP ( len ) 2 DO ( a r )
|
|
|
|
OVER I + C@ ( a r c ) _ ( a r n )
|
|
|
|
DUP 0< IF 2DROP 0 UNLOOP EXIT THEN
|
|
|
|
SWAP 1 LSHIFT + ( a r*2+n ) LOOP
|
|
|
|
NIP 1 ;
|