Mirror of CollapseOS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
468B

  1. : (parseb) ( a -- n f )
  2. ( '0': ASCII 0x30 'b': 0x62 0x6230: 25136 )
  3. DUP @ 25136 = NOT IF 0 EXIT THEN ( a 0 )
  4. ( We have "0b" prefix )
  5. 2+
  6. 0 ( a r )
  7. BEGIN
  8. SWAP C@+ ( r a+1 c )
  9. DUP NOT IF 2DROP 1 EXIT THEN ( r 1 )
  10. _ ( r a n )
  11. DUP 0< IF ROT 2DROP 0 EXIT THEN ( a 0 )
  12. ROT 2 * + ( a r*2+n )
  13. AGAIN
  14. ;