[Scummvm-devel] Re: [Scummvm-cvs-logs] CVS: scummvm configure,1.21,1.22
Marcus Comstedt
marcus at mc.pp.se
Mon Jun 2 06:19:17 CEST 2003
Max Horn <max at quendi.de> writes:
> OK. Would it work if I e.g. init the array to contain all 0xE7 bytes,
> and then compared to that value?
My suggestion would be to write two different values in sequence, and
then try to read both back and compare them with the expected value.
Also, the values should not be a repetition of the same byte; IIRC
doing an unaligned access on ARM will read the data from approximately
the specified address (after rounding it to the nearest word) but
rearrange the constituent bytes. Something like this ought to be
safe:
volatile union { uint8 c[12]; uint32 i[3]; } x;
volatile uint32 *p;
#if defined(SCUMM_BIG_ENDIAN)
memcpy(x.c, "\0\xe7\x12\x3c\x42\xc1\xf5\x17\x03\0\0\0", 12);
#else
memcpy(x.c, "\0\x42\x3c\x12\xe7\x03\x17\xf5\xc1\0\0\0", 12);
#endif
p = (uint32 *)(void *)&x.c[1];
if(p[0] != 0xe7123c42 || p[1] != 0xc1f51703)
exit(1);
A little paranoia never hurt anybody... :-)
// Marcus
More information about the Scummvm-devel
mailing list