Teach new_tarval_from_str_int() to parse binary numbers: 0[bB][01]+.
authorChristoph Mallon <christoph.mallon@gmx.de>
Sun, 6 May 2012 18:17:06 +0000 (20:17 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Sun, 6 May 2012 18:17:06 +0000 (20:17 +0200)
include/libfirm/tv.h
ir/tv/tv.c

index a013d84..9e10ec8 100644 (file)
@@ -70,6 +70,7 @@
  * if mode is int_number:
  *  - [+-]?0[xX][0-9a-fA-F]+ (hexadecimal representation)
  *  - [+-]?0[0-7]*           (octal representation)
+ *  - [+-]?0[bB][01]+        (binary representation)
  *  - [+-]?[1-9][0-9]*       (decimal representation)
  *
  * if mode is float_number:
index b6bb770..d926aea 100644 (file)
@@ -344,6 +344,10 @@ static ir_tarval *new_tarval_from_str_int(const char *str, size_t len,
                        str += 2;
                        len -= 2;
                        base = 16;
+               } else if (str[1] == 'b' || str[1] == 'B') {
+                       str += 2;
+                       len -= 2;
+                       base = 2;
                } else {
                        ++str;
                        --len;