comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Calculate and set Parity
Date: Wed, 18 Sep 2002 00:17:15 GMT
Date: 2002-09-18T00:17:15+00:00	[thread overview]
Message-ID: <fCPh9.503263$UU1.83536@sccrnsc03> (raw)
In-Reply-To: 3d879cde.85767138@news.cis.dfn.de

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

>  MOV AL, DataLo  ; load a byte
>  AND AL, AL      ; set PF
  change AND above to XOR AL,DataHi
>  LAHF            ; load flags byte
>  SHR AH, 2       ; shift PF into bit 0
>  AND AH, 1       ; mask off all other bits
>  MOV DL, AH      ; result into DL
  drop the following lines
>  MOV AL, DataHi
>  AND AL, AL
>  LAHF
>  SHR AH, 2
>  AND AH, 1
>  XOR DL, AH      ; parities must be XORed to get cumulative result



  parent reply	other threads:[~2002-09-18  0:17 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 [this message]
2002-09-18 20:25     ` Nick Roberts
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