From: "Matthew Heaney" <mheaney@on2.com>
Subject: Re: Perform "or" on a scalar type?
Date: Tue, 26 Feb 2002 11:05:47 -0500
Date: 2002-02-26T11:05:47-05:00 [thread overview]
Message-ID: <u7nc8pni13ape7@corp.supernews.com> (raw)
In-Reply-To: a5fnvq$6c3$1@newstoo.ericsson.se
"Verner" <sebastian.madunic@avionics.saab.se> wrote in message
news:a5fnvq$6c3$1@newstoo.ericsson.se...
> What is the easyiest way to persorm an "or" operation on a Unsigned_16 and
a
> scalar type?
Unsigned_16 already has a build-in "or" operation:
declare
I, J : Unsigned_16 := ...;
begin
... I or J ...
end;
If you want to mix U16 with other types (a signed integer, say), then you'll
have to convert the type to unsigned. You have to decide whether a straight
type conversion is appropriate, or whether Unchecked_Conversion is
necessary, e.g.
function To_Unsigned is new Unchecked_Conversion (Integer_16, Unsigned_16);
declare
I : Unsigned_16 := ...;
J : Integer_16 := ...;
K : Unsigned_16 := I or To_Unsigned (J);
begin
next prev parent reply other threads:[~2002-02-26 16:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-26 10:53 Perform "or" on a scalar type? Verner
2002-02-26 11:40 ` Larry Kilgallen
2002-02-26 16:05 ` Matthew Heaney [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-02-26 12:22 Gautier Write-only-address
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox