# include "config.h"
#endif
-
-#include "strcalc.h"
-
-#include <stdlib.h>
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
#ifdef HAVE_ALLOCA_H
# include <alloca.h>
#endif
#ifdef HAVE_MALLOC_H
# include <malloc.h>
#endif
+#ifdef HAVE_STRING_H
+# include <string.h> /* memset/memcmp */
+#endif
#include <assert.h> /* assertions */
-#include <string.h> /* memset/memcmp */
#include <stdio.h> /* output for error messages */
#include <limits.h> /* definition of LONG_MIN, used in sc_get_val_from_long */
+#include "strcalc.h"
+
/*
* local definitions and macros
*/
}
}
-long sc_val_to_long(const void *val, unsigned int bits, unsigned int is_signed)
+long sc_val_to_long(const void *val)
{
int i;
long l = 0;
for (i = CALC_BUFFER_SIZE - 1; i >= 0; i--)
+ {
l = (l << 4) + _val(((char *)val)[i]);
-
- if (bits < (sizeof(long) << 3)) {
- /* remove unused bits */
- l &= ~((-1) << bits);
-
- /* sign extend */
- if (is_signed)
- if (l & (1 << (bits-1)))
- l |= ((-1) << bits);
}
return l;
}
long offset;
carry_flag = 0;
- offset = sc_val_to_long(val2, radius, sign);
+ offset = sc_val_to_long(val2);
DEBUGPRINTF_COMPUTATION(("%s ", sc_print_hex(value1)));
switch (op)