* [patch] xstormy16::parity()
@ 2003-01-20 23:20 DJ Delorie
0 siblings, 0 replies; only message in thread
From: DJ Delorie @ 2003-01-20 23:20 UTC (permalink / raw)
To: cgen, sid
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-01-20 23:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-20 23:20 [patch] xstormy16::parity() DJ Delorie
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).