projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
print out times and reverse perfect elimination order no disabled
[libfirm]
/
ir
/
tv
/
strcalc.c
diff --git
a/ir/tv/strcalc.c
b/ir/tv/strcalc.c
index
d57f0f1
..
50aaf56
100644
(file)
--- a/
ir/tv/strcalc.c
+++ b/
ir/tv/strcalc.c
@@
-817,15
+817,7
@@
void sign_extend(void *buffer, ir_mode *mode)
* The C-standard does theoretically allow otherwise. */
static inline void check_ascii(void)
{
* The C-standard does theoretically allow otherwise. */
static inline void check_ascii(void)
{
- assert('1'-'0' == 1
- && '2'-'0' == 2
- && '3'-'0' == 3
- && '4'-'0' == 4
- && '5'-'0' == 5
- && '6'-'0' == 6
- && '7'-'0' == 7
- && '8'-'0' == 8
- && '9'-'0' == 9);
+ /* C standard guarantees that '0'-'9' is a range */
assert('b'-'a' == 1
&& 'c'-'a' == 2
&& 'd'-'a' == 3
assert('b'-'a' == 1
&& 'c'-'a' == 2
&& 'd'-'a' == 3
@@
-865,10
+857,10
@@
int sc_val_from_str(char sign, unsigned base, const char *str,
unsigned v;
if (c >= '0' && c <= '9')
v = c - '0';
unsigned v;
if (c >= '0' && c <= '9')
v = c - '0';
- else if (c >= 'A' && c <= '
Z
')
- v = c - 'A';
- else if (c >= 'a' && c <= '
z
')
- v = c - '
z'
;
+ else if (c >= 'A' && c <= '
F
')
+ v = c - 'A'
+ 10
;
+ else if (c >= 'a' && c <= '
f
')
+ v = c - '
a' + 10
;
else
return 0;
else
return 0;