comp.lang.ada
 help / color / mirror / Atom feed
From: "John R. Strohm" <strohm@airmail.net>
Subject: Re: crc and Ada
Date: Sun, 18 May 2003 02:27:05 -0500
Date: 2003-05-18T02:27:05-05:00	[thread overview]
Message-ID: <ba7csp$b52@library2.airnews.net> (raw)
In-Reply-To: slrnbcec3j.rh.swierczu@staticline881.toya.net.pl

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]

"Bart�omiej �." <swierczu@wpk.p.lodz.pl> wrote in message
news:slrnbcec3j.rh.swierczu@staticline881.toya.net.pl...
> 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:
> #v+
> ...
> crc=(crctable[((crc>>8)^bufor[start+i++]) & 0xFF]^(crc<<8))&0xFFFF;
> ...
> #v-
> What I should use instand of 'xor' and 'and' oparator (becouse in Ada
> they are logical oparator, not binary). For example, I replace crc<<8 by
> crc*256, and crc>>8 crc/256, but what about xor?

Check your compiler documentation.  They MAY export a machine intrinsics
package, which contains bitwise AND, OR, XOR, and such.

Check your compiler documentation.  Look for assembly language interfacing.
You certainly could write a little routine in assembly language that XOR'ed
two arguments and returned the result, and then hook it up to the Ada.

Also check your compiler documentation, for information about machine code
insertions.  CAUTION: Machine code insertions in Ada are NOT something a
novice should be tackling, but, occasionally, for political reasons, you can
get management approval for a machine code insertion where you couldn't get
approval for an assembly language subroutine.  (Been there, done that,
didn't WANT the T-shirt.)





  reply	other threads:[~2003-05-18  7:27 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 [this message]
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
replies disabled

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