From: Ludovic Brenta <ludovic.brenta@insalien.org>
Subject: Re: crc and Ada
Date: 19 May 2003 11:09:27 +0200
Date: 2003-05-19T11:09:27+02:00 [thread overview]
Message-ID: <rw21xyv9ubc.fsf@lbrenta.corp.emc.com> (raw)
In-Reply-To: slrnbcec3j.rh.swierczu@staticline881.toya.net.pl
Bart�omiej �. <swierczu@wpk.p.lodz.pl> writes:
> Hello,
> I'm starting in Ada, and I can't use same operators (like xor, and) in
> my programs. I need to count crc. In Java I was writting:
If your compiler is GNAT, there is the package System.CRC32. Look at
the sources in lib/gcc-lib/.../.../adainclude/s-crc32.ad{b,s}.
There is also an older version of this file at:
http://korea.gnu.org/gcc/src/gcc-3.1/gcc/ada/s-crc32.adb
http://korea.gnu.org/gcc/src/gcc-3.1/gcc/ada/s-crc32.ads
FWIW, consider the following code:
type CRC32 is new Interfaces.Unsigned_32;
-- Used to represent CRC32 values, which are 32 bit bit-strings
procedure Update (C : in out CRC32; Value : Character) is
V : constant CRC32 := CRC32 (Character'Pos (Value));
begin
C := Shift_Right (C, 8) xor Table (V xor (C and 16#0000_00FF#));
end Update;
HTH
--
Ludovic Brenta.
prev parent reply other threads:[~2003-05-19 9:09 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
2003-05-18 9:35 ` Bartłomiej Ś.
2003-05-18 8:05 ` Tarjei T. Jensen
2003-05-19 9:09 ` Ludovic Brenta [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox