comparison lwasm/lwasm.c @ 94:61c084b2c727

Fixed bug parsing %-prefix binary constants
author lost@l-w.ca
date Sat, 06 Aug 2011 10:29:12 -0600
parents ceab04fd2969
children a23f732c5ce8
comparison
equal deleted inserted replaced
93:5bf9edabd661 94:61c084b2c727
359 } 359 }
360 360
361 if (**p == '%') 361 if (**p == '%')
362 { 362 {
363 // binary constant 363 // binary constant
364 int v = 0;
365 (*p)++; 364 (*p)++;
366 365
367 if (**p == '-') 366 if (**p == '-')
368 { 367 {
369 (*p)++; 368 (*p)++;
376 while (**p && (**p == '0' || **p == '1')) 375 while (**p && (**p == '0' || **p == '1'))
377 { 376 {
378 val = val * 2 + (**p - '0'); 377 val = val * 2 + (**p - '0');
379 (*p)++; 378 (*p)++;
380 } 379 }
381 return lw_expr_build(lw_expr_type_int, v * neg); 380 return lw_expr_build(lw_expr_type_int, val * neg);
382 } 381 }
383 382
384 if (**p == '$') 383 if (**p == '$')
385 { 384 {
386 // hexadecimal constant 385 // hexadecimal constant