From: Jacob Sparre Andersen <sparre@nbi.dk>
Subject: Re: bitwise operations in Ada95
Date: Wed, 18 Jul 2001 18:09:05 +0200
Date: 2001-07-18T18:09:05+02:00 [thread overview]
Message-ID: <3B55B4A1.56150A4B@nbi.dk> (raw)
In-Reply-To: 192e1f87.0107180742.4e2e83df@posting.google.com
Aquaman:
> 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
"*2" and "/2" works fine for me for that purpose (on modular
types).
Using packed arrays of booleans "(Bit_Pattern
(Bit_Pattern'First + 1 .. Bit_Pattern'Last), 0)" and "(1,
Bit_Pattern (Bit_Pattern'First .. Bit_Pattern'Last - 1))"
could be used. But I would hide them in functions, and maybe
allow shifting by more than one bit at a time.
I am certain that all current Ada compilers will implement
the first of these two solutions "the optimal way". I am not
so certain about the second, but it could easily be checked.
Anyway. The abstract concept you actually want to implement
seems to be "*2" and "/2", so why not just use that.
Jacob
--
"The point is that I am now a perfectly safe penguin!"
next prev parent reply other threads:[~2001-07-18 16:09 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 [this message]
2001-07-19 9:03 ` Jacob Sparre Andersen
2001-07-18 20:17 ` Sune Falck
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox