summaryrefslogtreecommitdiffstatshomepage
path: root/src/emu/validity.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emu/validity.c')
-rw-r--r--src/emu/validity.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/src/emu/validity.c b/src/emu/validity.c
index 6bfaf303c31..faa37b60768 100644
--- a/src/emu/validity.c
+++ b/src/emu/validity.c
@@ -216,15 +216,15 @@ static void build_quarks(void)
static int validate_inlines(void)
{
#undef rand
- UINT64 testu64a = rand() + (rand() << 15) + ((UINT64)rand() << 30) + ((UINT64)rand() << 45) + 1;
- INT64 testi64a = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1;
+ volatile UINT64 testu64a = rand() ^ (rand() << 15) ^ ((UINT64)rand() << 30) ^ ((UINT64)rand() << 45);
+ volatile INT64 testi64a = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45);
#ifdef PTR64
- INT64 testi64b = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1;
+ volatile INT64 testi64b = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45);
#endif
- UINT32 testu32a = rand() + (rand() << 15) + 1;
- UINT32 testu32b = rand() + (rand() << 15) + 1;
- INT32 testi32a = rand() + (rand() << 15) + 1;
- INT32 testi32b = rand() + (rand() << 15) + 1;
+ volatile UINT32 testu32a = rand() ^ (rand() << 15);
+ volatile UINT32 testu32b = rand() ^ (rand() << 15);
+ volatile INT32 testi32a = rand() ^ (rand() << 15);
+ volatile INT32 testi32b = rand() ^ (rand() << 15);
INT32 resulti32, expectedi32;
UINT32 resultu32, expectedu32;
INT64 resulti64, expectedi64;
@@ -233,6 +233,21 @@ static int validate_inlines(void)
UINT32 uremainder, expuremainder;
int error = FALSE;
+ /* use only non-zero, positive numbers */
+ if (testu64a == 0) testu64a++;
+ if (testi64a == 0) testi64a++;
+ else if (testi64a < 0) testi64a = -testi64a;
+#ifdef PTR64
+ if (testi64b == 0) testi64b++;
+ else if (testi64b < 0) testi64b = -testi64b;
+#endif
+ if (testu32a == 0) testu32a++;
+ if (testu32b == 0) testu32b++;
+ if (testi32a == 0) testi32a++;
+ else if (testi32a < 0) testi32a = -testi32a;
+ if (testi32b == 0) testi32b++;
+ else if (testi32b < 0) testi32b = -testi32b;
+
resulti64 = mul_32x32(testi32a, testi32b);
expectedi64 = (INT64)testi32a * (INT64)testi32b;
if (resulti64 != expectedi64)