Re: Fast computation of parity
From: ScottD (bubba_at_aol.com)
Date: 12/31/03
- Next message: Tom St Denis: "Re: ANNOUNCE: SHA-224 in Digest::SHA"
- Previous message: Mok-Kong Shen: "Re: Idea for algo."
- In reply to: Mok-Kong Shen: "Re: Fast computation of parity"
- Next in thread: Randy Howard: "Re: Q: Fast computation of parity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Wed, 31 Dec 2003 07:42:58 -0600
"Mok-Kong Shen" <mok-kong.shen@t-online.de> wrote in message
news:3FF1C6BD.81239059@t-online.de...
>
>
> ScottD wrote:
> >
>
> > Here is a non-portable solution for x86:
> >
> > int parity (long int value)
> > {
> > __asm mov eax, value
> > __asm or eax, eax
> > __asm setp al
> > __asm and eax,1
> > }
>
> I attempted to use the above. However, the compiler
> complained that there is no return value. Could you fix
> that (since I know too little about asm)? (BTW, after
> an operation, the parity of the least significant
> byte is given in a parity flag, as far as I know.
> Could one make use of that, or have you already used
> that in the above?) Thanks.
>
> M. K. Shen
You are correct about the parity operation applying to the
least significant byte only. This code is completely incorrect
for that reason. Thanks for point that out. I tested the code,
but only with a few values that happened to fit in a single byte.
-- Scott
- Next message: Tom St Denis: "Re: ANNOUNCE: SHA-224 in Digest::SHA"
- Previous message: Mok-Kong Shen: "Re: Idea for algo."
- In reply to: Mok-Kong Shen: "Re: Fast computation of parity"
- Next in thread: Randy Howard: "Re: Q: Fast computation of parity"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|