From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8726 invoked by alias); 20 Jan 2003 23:20:06 -0000 Mailing-List: contact cgen-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cgen-owner@sources.redhat.com Received: (qmail 8697 invoked from network); 20 Jan 2003 23:20:05 -0000 Received: from unknown (HELO mx1.redhat.com) (172.16.49.200) by 172.16.49.205 with SMTP; 20 Jan 2003 23:20:05 -0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.11.6/8.11.6) with ESMTP id h0KMpMB30038; Mon, 20 Jan 2003 17:51:22 -0500 Received: from post-office.corp.redhat.com (post-office.corp.redhat.com [172.16.52.227]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0KNJwa27308; Mon, 20 Jan 2003 18:19:58 -0500 Received: from greed.delorie.com (dj.cipe.redhat.com [10.0.0.222]) by post-office.corp.redhat.com (8.11.6/8.11.6) with ESMTP id h0KNJvK01085; Mon, 20 Jan 2003 18:19:57 -0500 Received: (from dj@localhost) by greed.delorie.com (8.11.6/8.11.6) id h0KNK4N09960; Mon, 20 Jan 2003 18:20:04 -0500 Date: Mon, 20 Jan 2003 23:20:00 -0000 Message-Id: <200301202320.h0KNK4N09960@greed.delorie.com> From: DJ Delorie To: cgen@sources.redhat.com, sid@sources.redhat.com Subject: [patch] xstormy16::parity() X-SW-Source: 2003-q1/txt/msg00028.txt.bz2 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; }