From: "Tilman Gloetzner" <tilman.gloetzner@etas.co.kr>
Subject: Pascal to ADA
Date: Mon, 17 Nov 2003 10:12:22 -0000
Date: 2003-11-17T10:12:22+00:00 [thread overview]
Message-ID: <bpa46j$o0l$1@news1.kornet.net> (raw)
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 ;
next reply other threads:[~2003-11-17 10:12 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-17 10:12 Tilman Gloetzner [this message]
2003-11-17 10:24 ` Pascal to ADA Vinzent 'Gadget' Hoefler
2003-11-17 10:44 ` Marius Amado Alves
2003-11-17 11:41 ` Ole-Hjalmar Kristensen
[not found] ` <1069065860.2826.11.camel@localhost.localdomain>
2003-11-17 13:17 ` Marius Amado Alves
2003-11-17 14:42 ` Steve
2003-11-17 23:14 ` tmoran
2003-11-20 12:24 ` Lutz Donnerhacke
-- strict thread matches above, loose matches on Subject: below --
2001-02-14 19:29 pascal to Ada Munir Albeelbisi
2001-02-14 21:30 ` Pascal Obry
2001-02-15 12:22 ` Marc A. Criley
2001-02-15 17:31 ` Pascal Obry
2001-02-15 10:43 ` David C. Hoos, Sr.
2001-02-15 17:21 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox