comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: crc and Ada
Date: Sun, 18 May 2003 07:56:28 GMT
Date: 2003-05-18T07:56:28+00:00	[thread overview]
Message-ID: <M0Hxa.878367$3D1.501024@sccrnsc01> (raw)
In-Reply-To: slrnbcec3j.rh.swierczu@staticline881.toya.net.pl

> 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;



  parent reply	other threads:[~2003-05-18  7:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-05-18  7:04 crc and Ada Bartłomiej Ś.
2003-05-18  7:27 ` John R. Strohm
2003-05-18  7:38 ` Martin Krischik
2003-05-18  7:49 ` Martin Dowie
2003-05-18  7:56 ` tmoran [this message]
2003-05-18  9:35   ` Bartłomiej Ś.
2003-05-18  8:05 ` Tarjei T. Jensen
2003-05-19  9:09 ` Ludovic Brenta
replies disabled

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