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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no 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-18 00:33:02 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.airnews.net!cabal12.airnews.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.ada Subject: Re: crc and Ada Date: Sun, 18 May 2003 02:27:05 -0500 Organization: Airnews.net! at Internet America Message-ID: References: Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library2.airnews.net NNTP-Posting-Time: Sun, 18 May 2003 02:31:37 -0500 (CDT) NNTP-Posting-Host: !\C&k1k-W#m+uD' (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: archiver1.google.com comp.lang.ada:37464 Date: 2003-05-18T02:27:05-05:00 List-Id: "Bart�omiej �." 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.)