comp.lang.ada
 help / color / mirror / Atom feed
From: "Sune Falck" <Sune.Falck@telia.com>
Subject: Re: bitwise operations in Ada95
Date: Wed, 18 Jul 2001 20:17:28 GMT
Date: 2001-07-18T20:17:28+00:00	[thread overview]
Message-ID: <s9m57.10312$e5.1445260@newsb.telia.net> (raw)
In-Reply-To: 192e1f87.0107180742.4e2e83df@posting.google.com


"Aquaman" <Matthew.Waterman@Honeywell.com> wrote in message
news:192e1f87.0107180742.4e2e83df@posting.google.com...
> My question would be for a way to do bit shifting operations (vs. & |)
> so for example shift left and shift right for use in mathmatical mult and
div
> opperations
>
> thanks for any info

The standard package Interfaces contains the following shift and rotate
functions
for all defined modular types.

From the Ada 95 standard anexx B.2

package Interfaces is
  ...
  type Unsigned_n is mod 2**n;
   function Shift_Left  (Value : Unsigned_n; Amount : Natural) return
Unsigned_n;
  function Shift_Right (Value : Unsigned_n; Amount : Natural) return
Unsigned_n;
  function Shift_Right_Arithmetic (Value : Unsigned_n; Amount : Natural)
return Unsigned_n;
  function Rotate_Left  (Value : Unsigned_n; Amount : Natural) return
Unsigned_n;
  function Rotate_Right (Value : Unsigned_n; Amount : Natural) return
Unsigned_n;
 ...
end Interfaces;

Sune Falck






      parent reply	other threads:[~2001-07-18 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-18  1:28 bitwise operations in Ada95 Vladimir Bednikov
2001-07-18  2:43 ` tmoran
2001-07-18  9:50 ` Lutz Donnerhacke
2001-07-18 15:42   ` Aquaman
2001-07-18 16:09     ` Jacob Sparre Andersen
2001-07-19  9:03       ` Jacob Sparre Andersen
2001-07-18 20:17     ` Sune Falck [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