This is the mail archive of the cgen@sources.redhat.com mailing list for the CGEN project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] xstormy16::parity()


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;
  }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]