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,XPRIO autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,3727f1245650af64,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-11-17 02:08:01 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed.gol.com!newsfeed.kreonet.re.kr!nntp.kreonet.re.kr!kreonet.re.kr!feeder.kornet.net!news.kornet.net!not-for-mail From: "Tilman Gloetzner" Newsgroups: comp.lang.ada Subject: Pascal to ADA Date: Mon, 17 Nov 2003 10:12:22 -0000 Organization: Korea Telecom Message-ID: NNTP-Posting-Host: 211.196.217.245 X-Trace: news1.kornet.net 1069061139 24597 211.196.217.245 (17 Nov 2003 09:25:39 GMT) X-Complaints-To: usenet@feeder.kornet.net NNTP-Posting-Date: Mon, 17 Nov 2003 09:25:39 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Xref: archiver1.google.com comp.lang.ada:2560 Date: 2003-11-17T10:12:22+00:00 List-Id: Hello, 1) what is a effecient way of rewriting the following code fragement in ADA ? With the absolute keyword, Pascal effectively casts N, M, and R from a 4 byte integer type to an array of 4 bytes by an address access. I guess to implement the same mechanism in ADA is not in line with ADA's philosophy. 2) How do I mask out bits in a (unsigned) number type, as logical operators work only on booleans ? Thank you, Tilman ---------------------------------------------------------------- PROCEDURE Add32(N:LONGINT;M:LONGINT;VAR R:LONGINT) ; VAR _N : ARRAY[0..3] OF BYTE ABSOLUTE N ; _M : ARRAY[0..3] OF BYTE ABSOLUTE M ; _R : ARRAY[0..3] OF BYTE ABSOLUTE R ; A : BYTE ; B : WORD ; C : WORD ; { Carry } BEGIN R := 0 ; C := 0 ; FOR A := 0 TO 3 DO BEGIN B := _N[A] + _M[A] + C ; _R[A] := B AND $FF ; C := B SHR 8 ; END ; END ;