From: notaz Date: Thu, 17 Sep 2015 23:39:17 +0000 (+0200) Subject: 32bit fixes X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=421216a10ad76ab1887e54584849b9fcabe79c96;p=ia32rtools.git 32bit fixes --- diff --git a/tools/cmpmrg_text.c b/tools/cmpmrg_text.c index 38acd6d..561c9b2 100644 --- a/tools/cmpmrg_text.c +++ b/tools/cmpmrg_text.c @@ -474,7 +474,7 @@ static int check_equiv(uint8_t *d_obj, uint8_t *d_exe, int maxlen) break; if ((jo == len && je != len) || (jo != len && je == len)) { - printf("invalid equiv_op #%ld\n", op - equiv_ops); + printf("invalid equiv_op #%td\n", op - equiv_ops); return -1; } if (jo == len) diff --git a/tools/masm_tools.h b/tools/masm_tools.h index 717001f..cee4d62 100644 --- a/tools/masm_tools.h +++ b/tools/masm_tools.h @@ -1,7 +1,3 @@ -#if __SIZEOF_LONG__ != 8 -#error fix ret/strtoul to do 64bit -#endif - static unsigned long parse_number(const char *number) { int len = strlen(number); @@ -27,9 +23,16 @@ static unsigned long parse_number(const char *number) } if (bad) aerr("number parsing failed (%s)\n", number); - if (neg) +#if __SIZEOF_LONG__ > 4 + // if this happens, callers must be fixed too + if (ret > 0xfffffffful) + aerr("number too large? (%s)\n", number); +#endif + if (neg) { + if (ret > 0x7fffffff) + aerr("too large negative? (%s)\n", number); ret = -ret; + } return ret; } -