src/emu/validity.c
| r1304 | r1305 | |
| 216 | 216 | static int validate_inlines(void) |
| 217 | 217 | { |
| 218 | 218 | #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); |
| 221 | 221 | #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); |
| 223 | 223 | #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); |
| 228 | 228 | INT32 resulti32, expectedi32; |
| 229 | 229 | UINT32 resultu32, expectedu32; |
| 230 | 230 | INT64 resulti64, expectedi64; |
| 231 | 231 | UINT64 resultu64, expectedu64; |
| 232 | | // INT32 remainder, expremainder; |
| 233 | | // UINT32 uremainder, expuremainder; |
| 232 | INT32 remainder, expremainder; |
| 233 | UINT32 uremainder, expuremainder; |
| 234 | 234 | 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; |
| 235 | 250 | |
| 236 | 251 | resulti64 = mul_32x32(testi32a, testi32b); |
| 237 | 252 | expectedi64 = (INT64)testi32a * (INT64)testi32b; |
| r1304 | r1305 | |
| 263 | 278 | if (resultu32 != expectedu32) |
| 264 | 279 | { mame_printf_error("Error testing mulu_32x32_shift (%08X x %08X) >> 7 = %08X (expected %08X)\n", testu32a, testu32b, resultu32, expectedu32); error = TRUE; } |
| 265 | 280 | |
| 266 | | #if 0 |
| 267 | 281 | while ((INT64)testi32a * (INT64)0x7fffffff < testi64a) |
| 268 | 282 | testi64a /= 2; |
| 269 | 283 | while ((UINT64)testu32a * (UINT64)0xffffffff < testu64a) |
| r1304 | r1305 | |
| 305 | 319 | testi64a /= 2; |
| 306 | 320 | while ((UINT64)testu32a * (UINT64)0xffffffff < ((UINT32)testu64a << 3)) |
| 307 | 321 | testu64a /= 2; |
| 308 | | #endif |
| 322 | |
| 309 | 323 | resulti32 = div_32x32_shift((INT32)testi64a, testi32a, 3); |
| 310 | 324 | expectedi32 = ((INT64)(INT32)testi64a << 3) / (INT64)testi32a; |
| 311 | 325 | if (resulti32 != expectedi32) |