comp.lang.ada
 help / color / mirror / Atom feed
From: "Keith Allan Shillington" <keith@sd.aonix.com>
Subject: Re: Byte/Bit Twiddling in Ada
Date: 1997/02/14
Date: 1997-02-14T00:00:00+00:00	[thread overview]
Message-ID: <01bc1ac5$627c15f0$fc00af88@godiva> (raw)
In-Reply-To: 5dvfnn$olj@neocad.xilinx.com


Assumptions( Longword => 32 bits, Ada => Ada95 );

Given that: take this:

  type Longword is mod 2**32;  -- your milage may vary

  L, M: Longword;

begin

  L := 16#DEADBEEF#;

  M := L or 16#21727110#;

-- M should now be 16#FFFFFFFF#

want more?  See RM95 3.5.4

Jim Kruse <kruse@xilinx.com> wrote in article
<5dvfnn$olj@neocad.xilinx.com>...
> I'm relaying a question for a friend without Net access.
> 
> Is there any portable way to do byte and bit manipulation in Ada, on a
> long word?  I found no mention of this topic in the FAQ.
> 
> He is trying to avoid any non-Ada construct.  By this I think he means
> architecture-specific features (apparently there is a mechanism on the
> DEC Alpha machines, but he's not using an Alpha).
> 
> My friend is trying to write some code that does byte swapping,
> presumably to handle conversions to and from IEEE number formats.
> 
> Is there a package or library that handles this problem?
> 
> --
> Jim Kruse
> Xilinx, Inc.
> PGP Public Key available upon request
> 




       reply	other threads:[~1997-02-14  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5dvfnn$olj@neocad.xilinx.com>
1997-02-14  0:00 ` Keith Allan Shillington [this message]
1997-02-14  0:00 ` Byte/Bit Twiddling in Ada Mats Weber
1997-02-15  0:00   ` Robert Dewar
1997-02-15  0:00     ` wiljan
1997-02-26  0:00       ` Robert Dewar
1997-02-15  0:00   ` Robert Dewar
1997-02-14  0:00 ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox