From: "Vincent P. Amiot" <godzilla@mozilla.com>
Subject: Re: bit operations on integers
Date: 1999/05/04
Date: 1999-05-04T00:00:00+00:00 [thread overview]
Message-ID: <01be95c3$cae26ab0$3503af88@alesia> (raw)
In-Reply-To: 7gkhr7$5kr$1@nnrp1.dejanews.com
On Aonix/Alsys compilers there is a package 'Unsigned' that defines "and"
and "or" for 8 and 16 bit integers:
-- test Bit4
if (X and 2#0001_0000#) > 0 then
you can always resort to unchecked-convert to packed arrays of booleans of
the right size and implement your own.
A side note:
To represent 32 bit int in Ada83 when BIT31 is set (most of the Ada83
compiler do no accept: type X is range 0 .. 2**32-1; -- this would
theoretically require the availability of a 33 bit integer base type...
Bias : constant := 2**32;
K : constant := 16#AAAA_BBBB# - BIAS;
same bit pattern but negative!
Have fun!
Vincent Amiot
Principal Consultant / Aonix
--
phadreus@iname.com wrote in article <7gkhr7$5kr$1@nnrp1.dejanews.com>...
>
>
> How do I test, set, and clear individual bits in an integer
> in Ada 83?
>
> Thank you.
>
>
> -----------== Posted via Deja News, The Discussion Network ==----------
> http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
>
prev parent reply other threads:[~1999-05-04 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-03 0:00 bit operations on integers phadreus
1999-05-03 0:00 ` David C. Hoos, Sr.
1999-05-03 0:00 ` Keith Thompson
1999-05-03 0:00 ` Matthew Heaney
1999-05-03 0:00 ` dennison
1999-05-03 0:00 ` Jerry Petrey
1999-05-04 0:00 ` Vincent P. Amiot [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