Previous 15994 Revisions Next

r1305 Tuesday 20th November, 2007 at 04:07:03 UTC by R. Belmont
Official validity.c fix from Aaron Giles.
[src/emu]validity.c

src/emu/validity.c
r1304r1305
216216static int validate_inlines(void)
217217{
218218#undef rand
219   UINT64 testu64a = rand() + (rand() << 15) + ((UINT64)rand() << 30) + ((UINT64)rand() << 45) + 1;
220   INT64 testi64a = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1;
219   UINT64 testu64a = rand() ^ (rand() << 15) ^ ((UINT64)rand() << 30) ^ ((UINT64)rand() << 45);
220   INT64 testi64a = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45);
221221#ifdef PTR64
222   INT64 testi64b = rand() + (rand() << 15) + ((INT64)rand() << 30) + ((INT64)rand() << 45) + 1;
222   INT64 testi64b = rand() ^ (rand() << 15) ^ ((INT64)rand() << 30) ^ ((INT64)rand() << 45);
223223#endif
224   UINT32 testu32a = rand() + (rand() << 15) + 1;
225   UINT32 testu32b = rand() + (rand() << 15) + 1;
226   INT32 testi32a = rand() + (rand() << 15) + 1;
227   INT32 testi32b = rand() + (rand() << 15) + 1;
224   UINT32 testu32a = rand() ^ (rand() << 15);
225   UINT32 testu32b = rand() ^ (rand() << 15);
226   INT32 testi32a = rand() ^ (rand() << 15);
227   INT32 testi32b = rand() ^ (rand() << 15);
228228   INT32 resulti32, expectedi32;
229229   UINT32 resultu32, expectedu32;
230230   INT64 resulti64, expectedi64;
231231   UINT64 resultu64, expectedu64;
232//   INT32 remainder, expremainder;
233//   UINT32 uremainder, expuremainder;
232   INT32 remainder, expremainder;
233   UINT32 uremainder, expuremainder;
234234   int error = FALSE;
235   
236   /* use only non-zero, positive numbers */
237   if (testu64a == 0) testu64a++;
238   if (testi64a == 0) testi64a++;
239   else if (testi64a < 0) testi64a = -testi64a;
240#ifdef PTR64
241   if (testi64b == 0) testi64b++;
242   else if (testi64b < 0) testi64b = -testi64b;
243#endif
244   if (testu32a == 0) testu32a++;
245   if (testu32b == 0) testu32b++;
246   if (testi32a == 0) testi32a++;
247   else if (testi32a < 0) testi32a = -testi32a;
248   if (testi32b == 0) testi32b++;
249   else if (testi32b < 0) testi32b = -testi32b;
235250
236251   resulti64 = mul_32x32(testi32a, testi32b);
237252   expectedi64 = (INT64)testi32a * (INT64)testi32b;
r1304r1305
263278   if (resultu32 != expectedu32)
264279      { mame_printf_error("Error testing mulu_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32); error = TRUE; }
265280
266#if 0
267281   while ((INT64)testi32a * (INT64)0x7fffffff < testi64a)
268282      testi64a /= 2;
269283   while ((UINT64)testu32a * (UINT64)0xffffffff < testu64a)
r1304r1305
305319      testi64a /= 2;
306320   while ((UINT64)testu32a * (UINT64)0xffffffff < ((UINT32)testu64a << 3))
307321      testu64a /= 2;
308#endif
322
309323   resulti32 = div_32x32_shift((INT32)testi64a, testi32a, 3);
310324   expectedi32 = ((INT64)(INT32)testi64a << 3) / (INT64)testi32a;
311325   if (resulti32 != expectedi32)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team