comparison lwasm/lwasm.c @ 582:1ede8f8621cf default tip

Actually treat "0b" as 0 since it matches the "b" suffix for binary numbers
author William Astle <lost@l-w.ca>
date Thu, 08 Aug 2024 13:46:19 -0600
parents 10f8fc64481d
children
comparison
equal deleted inserted replaced
581:10f8fc64481d 582:1ede8f8621cf
647 // binary constant 647 // binary constant
648 (*p) += 2; 648 (*p) += 2;
649 649
650 if (**p != '0' && **p != '1') 650 if (**p != '0' && **p != '1')
651 { 651 {
652 (*p) -= 2; 652 // in this case, we have 0 (suffix notation 0b)
653 return NULL; 653 return lw_expr_build(lw_expr_type_int, 0);
654 } 654 }
655 655
656 while (**p && (**p == '0' || **p == '1')) 656 while (**p && (**p == '0' || **p == '1'))
657 { 657 {
658 val = val * 2 + (**p - '0'); 658 val = val * 2 + (**p - '0');