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,ce2598d1b5ccf8c8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-18 00:56:31 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi_feed4!attbi.com!sccrnsc01.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: crc and Ada References: X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1053244588 12.234.13.56 (Sun, 18 May 2003 07:56:28 GMT) NNTP-Posting-Date: Sun, 18 May 2003 07:56:28 GMT Organization: AT&T Broadband Date: Sun, 18 May 2003 07:56:28 GMT Xref: archiver1.google.com comp.lang.ada:37468 Date: 2003-05-18T07:56:28+00:00 List-Id: > I'm starting in Ada, and I can't use same operators (like xor, and) in Take another look at your Ada text. There are indeed "and", "xor" etc operators for modular (unsigned) types. > crc=(crctable[((crc>>8)^bufor[start+i++]) & 0xFF]^(crc<<8))&0xFFFF; type crc_type is mod 2**16; crc : crc_type := initial value type byte is mod 256; crc_table : array(byte) of crc_type; for i in start .. finish loop crc:=crc_table(byte(crc/256) xor bufor(i)) xor ((crc mod 256)*256); end loop;