comp.lang.ada
 help / color / mirror / Atom feed
From: "Vladimir Olensky" <vladimir_olensky@yahoo.com>
Subject: Re: Or
Date: 2000/01/31
Date: 2000-01-31T00:00:00+00:00	[thread overview]
Message-ID: <s9brafec5io30@corp.supernews.com> (raw)
In-Reply-To: vhioga2t8wa.fsf@ljod.ifi.uio.no


Jan Kroken wrote in message ...
>
>I need bitwise or on Interfaces.C.Int. I couldn't find any
>direct or operator in Ada, so I wrote the following:


Ada modular types provide bitwise operations.
So if you need bitwise operations on Integers or C.Int
you should change their view to modular type and then
do bitwise operations.

Something like this:

CIM is new  Ada.Unchecked_Conversion ( Interfaces.C.Int,

Interfaces.C.Unsigned);
CMI is new  Ada.Unchecked_Conversion (  Interfaces.C.Unsigned,

Interfaces.C.Int);

...
a : Interfaces.C.Int;
b : Interfaces.C.Int;
c :  Interfaces.C.Int;


c  := CMI ( CIM(a) or  CIM (b) );

That's all you need.

Regards,
Vladimir Olensky








  parent reply	other threads:[~2000-01-31  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <vhioga2t8wa.fsf@ljod.ifi.uio.no>
2000-01-31  0:00 ` Or tmoran
2000-01-31  0:00 ` Vladimir Olensky [this message]
2000-01-31  0:00 ` Or Gisle S�lensminde
2000-01-31  0:00 ` Or Mark A Biggar
2000-01-31  0:00 ` Or David Starner
replies disabled

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