#include <limits.h> /* definition of LONG_MIN, used in sc_get_val_from_long */
#include "strcalc.h"
+#include "xmalloc.h"
/*
* local definitions and macros
However, the meaning of carry is machine dependent
and often defined in other ways! */
-static const char sex_digit[4] = { SC_F, SC_E, SC_C, SC_8 };
+static const char sex_digit[4] = { SC_E, SC_C, SC_8, SC_0 };
static const char max_digit[4] = { SC_0, SC_1, SC_3, SC_7 };
static const char min_digit[4] = { SC_F, SC_E, SC_C, SC_8 };
for (i = ofs + 1; i < calc_buffer_size; ++i)
calc_buffer[i] = SC_F;
- calc_buffer[ofs] = sex_digit[bits & 3];
+ calc_buffer[ofs] = or_table[calc_buffer[ofs]][sex_digit[bits & 3]];
}
}
}
calc_buffer_size = (precision / 2);
max_value_size = (precision / 4);
- calc_buffer = malloc(calc_buffer_size+1 * sizeof(char));
- output_buffer = malloc(bit_pattern_size+1 * sizeof(char));
+ calc_buffer = xmalloc(calc_buffer_size+1 * sizeof(char));
+ output_buffer = xmalloc(bit_pattern_size+1 * sizeof(char));
if (calc_buffer == NULL || output_buffer == NULL) {
assert(0 && "malloc failed");