From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Does Ada support endiannes?
Date: Thu, 15 Dec 2011 14:37:54 +0100
Date: 2011-12-15T14:37:54+01:00 [thread overview]
Message-ID: <1iewajwb4t87p.1oltp4lr73tg3.dlg@40tude.net> (raw)
In-Reply-To: 71bc4e7f-7c23-4180-9a8d-5c880a16d0c2@p16g2000yqd.googlegroups.com
On Thu, 15 Dec 2011 03:27:48 -0800 (PST), Gerd wrote:
> Could you please explain: What do you think how the data send from 68k
> to x86 will be converted from one data layout to the other?
Assuming 68k is big endian, two's complement:
type Octet is new Unsigned_8;
function From_Motorola (First, Second : Octet) return Integer_16 is
begin
if First > 127 then
return -1 - Integer_16 (not First) * 256 -
Integer_16 (not Second);
else
return Integer_16 (First) * 256 + Integer_16 (Second);
end if;
end From_Motorola;
Note that the code is target machine's endianness agnostic.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2011-12-15 13:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 8:57 Does Ada support endiannes? Gerd
2011-12-12 9:23 ` Niklas Holsti
2011-12-12 11:27 ` Dmitry A. Kazakov
2011-12-12 12:44 ` Gerd
2011-12-12 19:23 ` Jeffrey Carter
2011-12-13 14:25 ` Gerd
2011-12-13 14:19 ` Gautier write-only
2011-12-14 16:16 ` Gerd
2011-12-14 18:16 ` Dmitry A. Kazakov
2011-12-14 20:16 ` Gautier write-only
2011-12-15 11:27 ` Gerd
2011-12-15 13:01 ` Simon Wright
2011-12-15 13:37 ` Dmitry A. Kazakov [this message]
2011-12-15 20:12 ` Jeffrey Carter
2011-12-12 12:46 ` Gerd
2011-12-12 13:22 ` Dmitry A. Kazakov
2011-12-12 17:07 ` Charles H. Sampson
2011-12-12 18:33 ` Dmitry A. Kazakov
2011-12-14 5:19 ` Charles H. Sampson
2011-12-14 8:56 ` Dmitry A. Kazakov
2011-12-14 9:46 ` Simon Wright
2011-12-15 9:14 ` Charles H. Sampson
2011-12-15 9:46 ` Dmitry A. Kazakov
2011-12-25 21:42 ` Charles H. Sampson
2011-12-26 10:47 ` Dmitry A. Kazakov
2011-12-27 10:38 ` Georg Bauhaus
2011-12-27 12:35 ` Dmitry A. Kazakov
2012-01-04 4:33 ` Charles H. Sampson
2012-01-04 11:56 ` Dmitry A. Kazakov
2011-12-12 13:33 ` Robert A Duff
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox