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 X-Google-Thread: 103376,ce2598d1b5ccf8c8 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-19 02:08:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!newsfeed.icl.net!newsfeed.fjserv.net!skynet.be!skynet.be!louie!tlk!not-for-mail Sender: lbrenta@lbrenta.corp.emc.com Newsgroups: comp.lang.ada Subject: Re: crc and Ada References: From: Ludovic Brenta Date: 19 May 2003 11:09:27 +0200 Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 213.190.149.159 X-Trace: 1053335283 reader0.news.skynet.be 11139 fa058819/213.190.149.159:37089 X-Complaints-To: abuse@skynet.be Xref: archiver1.google.com comp.lang.ada:37508 Date: 2003-05-19T11:09:27+02:00 List-Id: Bart�omiej �. 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.