public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: DJ Delorie <dj@redhat.com>
To: cgen@sources.redhat.com, sid@sources.redhat.com
Subject: [patch] xstormy16::parity()
Date: Mon, 20 Jan 2003 23:20:00 -0000	[thread overview]
Message-ID: <200301202320.h0KNK4N09960@greed.delorie.com> (raw)


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

             reply	other threads:[~2003-01-20 23:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-20 23:20 DJ Delorie [this message]
2003-01-20 23:22 ` DJ Delorie
2003-01-20 23:38   ` Doug Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200301202320.h0KNK4N09960@greed.delorie.com \
    --to=dj@redhat.com \
    --cc=cgen@sources.redhat.com \
    --cc=sid@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).