From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5347e7d1cde09e09 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-26 08:00:27 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!sn-xit-03!sn-post-02!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Perform "or" on a scalar type? Date: Tue, 26 Feb 2002 11:05:47 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-Complaints-To: newsabuse@supernews.com Xref: archiver1.google.com comp.lang.ada:20462 Date: 2002-02-26T11:05:47-05:00 List-Id: "Verner" 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