From: Christoph Mallon Date: Sun, 6 May 2012 18:17:06 +0000 (+0200) Subject: Teach new_tarval_from_str_int() to parse binary numbers: 0[bB][01]+. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=0bddf6c31e2dc664e50eed6609ac36a1a86e1536;p=libfirm Teach new_tarval_from_str_int() to parse binary numbers: 0[bB][01]+. --- diff --git a/include/libfirm/tv.h b/include/libfirm/tv.h index a013d8432..9e10ec80e 100644 --- a/include/libfirm/tv.h +++ b/include/libfirm/tv.h @@ -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: diff --git a/ir/tv/tv.c b/ir/tv/tv.c index b6bb77094..d926aea20 100644 --- a/ir/tv/tv.c +++ b/ir/tv/tv.c @@ -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;