X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tools%2Fmasm_tools.h;h=cee4d62de69a3a509a71f9e87ff69825685c3943;hb=421216a10ad76ab1887e54584849b9fcabe79c96;hp=717001ffd964c6dea51974d511031a8d2d4a7eae;hpb=0ea6430ca5707ae1e6ddd43d5e01dbc0f6979bf4;p=ia32rtools.git 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; } -