mirror of
https://github.com/holub/mame
synced 2025-07-04 09:28:51 +03:00
validity: add basic signed integer arithmetic tests to core validation [Alex Jackson]
This commit is contained in:
parent
382dd0f616
commit
91be2c989e
@ -326,6 +326,8 @@ void validity_checker::validate_one(const game_driver &driver)
|
|||||||
void validity_checker::validate_core()
|
void validity_checker::validate_core()
|
||||||
{
|
{
|
||||||
// basic system checks
|
// basic system checks
|
||||||
|
if (~0 != -1) osd_printf_error("Machine must be two's complement\n");
|
||||||
|
|
||||||
UINT8 a = 0xff;
|
UINT8 a = 0xff;
|
||||||
UINT8 b = a + 1;
|
UINT8 b = a + 1;
|
||||||
if (b > a) osd_printf_error("UINT8 must be 8 bits\n");
|
if (b > a) osd_printf_error("UINT8 must be 8 bits\n");
|
||||||
@ -340,6 +342,16 @@ void validity_checker::validate_core()
|
|||||||
if (sizeof(INT64) != 8) osd_printf_error("INT64 must be 64 bits\n");
|
if (sizeof(INT64) != 8) osd_printf_error("INT64 must be 64 bits\n");
|
||||||
if (sizeof(UINT64) != 8) osd_printf_error("UINT64 must be 64 bits\n");
|
if (sizeof(UINT64) != 8) osd_printf_error("UINT64 must be 64 bits\n");
|
||||||
|
|
||||||
|
// check signed right shift
|
||||||
|
INT8 a8 = -3;
|
||||||
|
INT16 a16 = -3;
|
||||||
|
INT32 a32 = -3;
|
||||||
|
INT64 a64 = -3;
|
||||||
|
if (a8 >> 1 != -2) osd_printf_error("INT8 right shift must be arithmetic\n");
|
||||||
|
if (a16 >> 1 != -2) osd_printf_error("INT16 right shift must be arithmetic\n");
|
||||||
|
if (a32 >> 1 != -2) osd_printf_error("INT32 right shift must be arithmetic\n");
|
||||||
|
if (a64 >> 1 != -2) osd_printf_error("INT64 right shift must be arithmetic\n");
|
||||||
|
|
||||||
// check pointer size
|
// check pointer size
|
||||||
#ifdef PTR64
|
#ifdef PTR64
|
||||||
if (sizeof(void *) != 8) osd_printf_error("PTR64 flag enabled, but was compiled for 32-bit target\n");
|
if (sizeof(void *) != 8) osd_printf_error("PTR64 flag enabled, but was compiled for 32-bit target\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user