comp.lang.ada
 help / color / mirror / Atom feed
From: nickroberts@blueyonder.co.uk (Nick Roberts)
Subject: Re: Calculate and set Parity
Date: Wed, 18 Sep 2002 20:25:53 GMT
Date: 2002-09-18T20:25:53+00:00	[thread overview]
Message-ID: <3d88df22.168279476@news.cis.dfn.de> (raw)
In-Reply-To: fCPh9.503263$UU1.83536@sccrnsc03

On Wed, 18 Sep 2002 00:17:15 GMT, tmoran@acm.org strongly typed:

>The XOR of the parities equals the parity of the XORed bytes.
>Thus the code can be shortened:
>...

Absolutely correct. I forgot this in my haste (and the lateness of the
hour). The revised code then is:

   MOV AX, Data    ; load a 16-bit word
   XOR AL, AH      ; XOR upper byte with lower
                   ; and at the same time set PF
   LAHF            ; load flags byte
   SHR AH, 2       ; shift PF into bit 0
   AND AH, 1       ; mask off all other bits

which leaves the result in AH. 

-- 
Nick Roberts
Per Ardua ad Disastra




  reply	other threads:[~2002-09-18 20:25 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-16 16:42 Calculate and set Parity Sebastian
2002-09-16 18:14 ` Stephen Leake
2002-09-16 18:58 ` Jeffrey Carter
2002-09-16 19:51   ` tmoran
2002-09-17  1:36   ` tmoran
2002-09-17 22:05 ` Nick Roberts
2002-09-17 23:23   ` tmoran
2002-09-18  0:17   ` tmoran
2002-09-18 20:25     ` Nick Roberts [this message]
2002-09-18  2:52 ` SteveD
2002-09-18 18:29 ` Parity using 'Write, was " tmoran
2002-09-18 18:47   ` David C. Hoos
2002-09-18 22:17     ` tmoran
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox