[patch] xstormy16::parity()
DJ Delorie
dj@redhat.com
Mon Jan 20 23:20:00 GMT 2003
The fix seemed obvious to me, but being paranoid, I even wrote a test
program to test all 65536 values against a brute-force method. Ok?
* xstormy16.cxx (parity): Fix logic.
Index: xstormy16.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/cgen-cpu/xstormy16/xstormy16.cxx,v
retrieving revision 1.2
diff -p -3 -r1.2 xstormy16.cxx
*** xstormy16.cxx 11 Jan 2002 07:25:02 -0000 1.2
--- xstormy16.cxx 20 Jan 2003 23:16:53 -0000
*************** xstormy16_cpu::parity (int reg)
*** 358,365 ****
{
int tmp;
tmp = reg ^ (reg >> 8);
! tmp ^= reg >> 4;
! tmp ^= reg >> 2;
! tmp ^= reg >> 1;
return tmp & 1;
}
--- 358,365 ----
{
int tmp;
tmp = reg ^ (reg >> 8);
! tmp ^= tmp >> 4;
! tmp ^= tmp >> 2;
! tmp ^= tmp >> 1;
return tmp & 1;
}
More information about the Sid
mailing list