delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/10/16:26:30

Date: Fri, 11 Jul 1997 08:27:47 +0000
From: Bill Currie <billc AT blackmagic DOT tait DOT co DOT nz>
Subject: Re: odd or even # of 1's (was: no subject)
To: Christoph Kukulies <kuku AT gilberto DOT physik DOT rwth-aachen DOT de>
Cc: "Chirayu Krishnappa (chirayu AT poboxes DOT com)" <chirayu AT giasbga DOT vsnl DOT net DOT in>,
djgpp AT delorie DOT com
Reply-to: billc AT blackmagic DOT tait DOT co DOT nz
Message-id: <33C5EE83.1FD1@blackmagic.tait.co.nz>
Organization: Tait Electronics NZ
MIME-version: 1.0
References: <Pine DOT SV4 DOT 3 DOT 93 DOT 970710151909 DOT 18181A-100000 AT giasbga>
<19970710152801 DOT 34479 AT gil DOT physik DOT rwth-aachen DOT de>

Christoph Kukulies wrote:
> You could do an inline assembly operation like or'ing the integer
> to itself and examine the PF (parity flag) of the EFLAGS CPU
> register afterwards, e.g. by a JPE (conditional jump short on parity even
> PF=1).

You'ld be better off using 'setpe' rather than 'jpe', as it't much less
expensive:

asm volatile("or %1,%1;setpe %b0":"=g"(result):"r"(value):"cc");

Bill
-- 
Leave others their otherness.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019