projects
/
libfirm
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
- use ir_nodemap_t instead of pset: This probably
[libfirm]
/
ir
/
tv
/
strcalc.c
diff --git
a/ir/tv/strcalc.c
b/ir/tv/strcalc.c
index
1a078eb
..
208a2b3
100644
(file)
--- a/
ir/tv/strcalc.c
+++ b/
ir/tv/strcalc.c
@@
-25,9
+25,7
@@
* @version $Id$
*/
* @version $Id$
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
@@
-1325,7
+1323,7
@@
const char *sc_print(const void *value, unsigned bits, enum base_t base, int sig
static const char small_digits[] = "0123456789abcdef";
char *base_val, *div1_res, *div2_res, *rem_res;
static const char small_digits[] = "0123456789abcdef";
char *base_val, *div1_res, *div2_res, *rem_res;
- int counter, nibbles, i, sign;
+ int counter, nibbles, i, sign
, mask
;
char x;
const char *val = (const char *)value;
char x;
const char *val = (const char *)value;
@@
-1365,7
+1363,8
@@
const char *sc_print(const void *value, unsigned bits, enum base_t base, int sig
/* last nibble must be masked */
if (bits & 3) {
/* last nibble must be masked */
if (bits & 3) {
- x = and_table[_val(val[++counter])][bits & 3];
+ mask = zex_digit[bits & 3];
+ x = and_table[_val(val[counter++])][mask];
*(--pos) = digits[_val(x)];
}
*(--pos) = digits[_val(x)];
}
@@
-1391,7
+1390,8
@@
const char *sc_print(const void *value, unsigned bits, enum base_t base, int sig
/* last nibble must be masked */
if (bits & 3) {
/* last nibble must be masked */
if (bits & 3) {
- x = and_table[_val(val[++counter])][bits & 3];
+ mask = zex_digit[bits & 3];
+ x = and_table[_val(val[counter++])][mask];
pos -= 4;
p = binary_table[_val(x)];
pos -= 4;
p = binary_table[_val(x)];
@@
-1430,9
+1430,9
@@
const char *sc_print(const void *value, unsigned bits, enum base_t base, int sig
/* last nibble must be masked */
if (bits & 3) {
/* last nibble must be masked */
if (bits & 3) {
+ mask = zex_digit[bits & 3];
+ div1_res[counter] = and_table[_val(p[counter])][mask];
++counter;
++counter;
-
- div1_res[counter] = and_table[_val(p[counter])][bits & 3];
}
m = div1_res;
}
m = div1_res;
@@
-1472,8
+1472,8
@@
void init_strcalc(int precision) {
calc_buffer_size = (precision / 2);
max_value_size = (precision / 4);
calc_buffer_size = (precision / 2);
max_value_size = (precision / 4);
- calc_buffer =
xmalloc(calc_buffer_size+1 * sizeof(char)
);
- output_buffer =
xmalloc(bit_pattern_size+1 * sizeof(char)
);
+ calc_buffer =
XMALLOCN(char, calc_buffer_size + 1
);
+ output_buffer =
XMALLOCN(char, bit_pattern_size + 1
);
DEBUGPRINTF(("init strcalc: \n\tPRECISION: %d\n\tCALC_BUFFER_SIZE = %d\n\tMAX_VALUE_SIZE = %d\n\tbuffer pointer: %p\n", precision, calc_buffer_size, max_value_size, calc_buffer));
}
DEBUGPRINTF(("init strcalc: \n\tPRECISION: %d\n\tCALC_BUFFER_SIZE = %d\n\tMAX_VALUE_SIZE = %d\n\tbuffer pointer: %p\n", precision, calc_buffer_size, max_value_size, calc_buffer));
}