diff options
author | 2018-03-21 16:48:52 +0000 | |
---|---|---|
committer | 2018-03-21 16:49:27 +0000 | |
commit | 0883f01e66aee87a08b50f82bbccfa4cd03e95cc (patch) | |
tree | 02bcf84163386d196c842e259bfa98593bc26438 | |
parent | 418bc70cfa3b293cdfdcdefcbd6ea6aed60cd69a (diff) |
validity check: test all 32 results from count_leading_zeros() & count_leading_ones() [smf]
-rw-r--r-- | src/emu/validity.cpp | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/emu/validity.cpp b/src/emu/validity.cpp index 0a3d87ea58b..5a74a100147 100644 --- a/src/emu/validity.cpp +++ b/src/emu/validity.cpp @@ -511,16 +511,18 @@ void validity_checker::validate_inlines() if (fabsf(recip_approx(100.0f) - 0.01f) > 0.0001f) osd_printf_error("Error testing recip_approx\n"); - testi32a = (testi32a & 0x0000ffff) | 0x400000; - if (count_leading_zeros(testi32a) != 9) - osd_printf_error("Error testing count_leading_zeros\n"); - if (count_leading_zeros(0) != 32) - osd_printf_error("Error testing count_leading_zeros\n"); - testi32a = (testi32a | 0xffff0000) & ~0x400000; - if (count_leading_ones(testi32a) != 9) - osd_printf_error("Error testing count_leading_ones\n"); - if (count_leading_ones(0xffffffff) != 32) - osd_printf_error("Error testing count_leading_ones\n"); + for (int i = 0; i <= 32; i++) + { + u32 t = i < 32 ? (1 << (31 - i) | testu32a >> i) : 0; + u8 resultu8 = count_leading_zeros(t); + if (resultu8 != i) + osd_printf_error("Error testing count_leading_zeros %08x=%02x (expected %02x)\n", t, resultu8, i); + + t ^= 0xffffffff; + resultu8 = count_leading_ones(t); + if (resultu8 != i) + osd_printf_error("Error testing count_leading_ones %08x=%02x (expected %02x)\n", t, resultu8, i); + } } |