From: "SteveD" <nospam_steved94@attbi.com>
Subject: Re: creating a 16 bit value from 2 8 bit values in Ada (again)
Date: Sat, 03 Aug 2002 02:02:10 GMT
Date: 2002-08-03T02:02:10+00:00 [thread overview]
Message-ID: <CQG29.230738$Wt3.201042@rwcrnsc53> (raw)
In-Reply-To: a5ae824.0208011740.7f2df9dc@posting.google.com
Sorry about my previous accidental send.
Here is how I would do it (the following compiles and runs on GNAT
3.14p-nt):
with Ada.Text_Io;
with Interfaces;
use Interfaces;
procedure Test is
function To_Unsigned_16( lsb, msb : Unsigned_8 ) return Unsigned_16 is
begin
return Shift_Left( Unsigned_16( msb ), 8 ) or Unsigned_16( lsb );
end To_Unsigned_16;
begin
Ada.Text_Io.Put_Line( Unsigned_16'IMAGE( To_Unsigned_16( 16#01#,
16#00# ) ) );
Ada.Text_Io.Put_Line( Unsigned_16'IMAGE( To_Unsigned_16( 16#00#,
16#01# ) ) );
end Test;
SteveD
prev parent reply other threads:[~2002-08-03 2:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-02 1:40 creating a 16 bit value from 2 8 bit values in Ada Mark
2002-08-02 2:07 ` Darren New
2002-08-02 8:36 ` John McCabe
2002-08-02 18:21 ` Stephen Leake
2002-08-03 14:37 ` Robert Dewar
2002-08-03 0:52 ` Kevin Krieser
2002-08-03 1:59 ` SteveD
2002-08-03 2:02 ` SteveD [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox