From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,255a2533fba89f5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-16 18:48:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!enews.sgi.com!sdd.hp.com!usc.edu!attla2!ip.att.net!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Calculate and set Parity References: <3D8629D3.2040603@acm.org> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1032204444 12.234.13.56 (Mon, 16 Sep 2002 19:27:24 GMT) NNTP-Posting-Date: Mon, 16 Sep 2002 19:27:24 GMT Organization: AT&T Broadband Date: Tue, 17 Sep 2002 01:36:50 GMT Xref: archiver1.google.com comp.lang.ada:29054 Date: 2002-09-17T01:36:50+00:00 List-Id: > array of Boolean seems like a good way to go. You then simply add up the > Boolean'Pos of each element and determine if the result is even or odd > ("rem 2"). You could do an unchecked conversion to a 16-bit modular type > and use shifts and masks to isolate the individual bits, but using > Booleans seems simpler. If speed is a consideration, and memory is available, convert to an array of a 16 or an 8 bit type and look up the parity of each element in a lookup table, then XOR the parities together.