Commit 0bddf6c3 authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Teach new_tarval_from_str_int() to parse binary numbers: 0[bB][01]+.

parent e48a03a6
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
* if mode is int_number: * if mode is int_number:
* - [+-]?0[xX][0-9a-fA-F]+ (hexadecimal representation) * - [+-]?0[xX][0-9a-fA-F]+ (hexadecimal representation)
* - [+-]?0[0-7]* (octal representation) * - [+-]?0[0-7]* (octal representation)
* - [+-]?0[bB][01]+ (binary representation)
* - [+-]?[1-9][0-9]* (decimal representation) * - [+-]?[1-9][0-9]* (decimal representation)
* *
* if mode is float_number: * if mode is float_number:
......
...@@ -344,6 +344,10 @@ static ir_tarval *new_tarval_from_str_int(const char *str, size_t len, ...@@ -344,6 +344,10 @@ static ir_tarval *new_tarval_from_str_int(const char *str, size_t len,
str += 2; str += 2;
len -= 2; len -= 2;
base = 16; base = 16;
} else if (str[1] == 'b' || str[1] == 'B') {
str += 2;
len -= 2;
base = 2;
} else { } else {
++str; ++str;
--len; --len;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment