comp.lang.ada
 help / color / mirror / Atom feed
From: bgaffney42@aol.com (BGaffney42)
Subject: Re: Ada 83 - avoiding unchecked conversions.
Date: 1996/12/14
Date: 1996-12-14T00:00:00+00:00	[thread overview]
Message-ID: <19961214022200.VAA03584@ladder01.news.aol.com> (raw)
In-Reply-To: mheaney-ya023280001112962007210001@news.ni.net


I'm sorry, I must be missing something.  Why would you want to use
Unchecked_Conversion or some form of overlay for this problem?  Why can't
the following function be used (assuming Integer_16 and Integer_32 are
defined with appropriate ranges and 'Sizes?

    function Convert (Hi, Lo : Integer_16) return Integer_32 is
        Shift_16 : constant Integer_32 := 2**16;
    begin
        if Lo < 0 then
            return Integer_32(Hi) * Shift_16 + (Shift_16 +
Integer_32(Lo));
        else
            return Integer_32(Hi) * Shift_16 + Integer_32(Lo);
        end if;
    end Convert;

-- _really_ psycho engineer 
-- using Ada as a toy and _not_ working for an Ada vendor!
                                                                 --Brian
Gaffney





  parent reply	other threads:[~1996-12-14  0:00 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <md5:8B831999BCF200C6E70994BDF6CC529F>
1996-12-11  0:00 ` Ada 83 - avoiding unchecked conversions Chris Sparks (Mr. Ada)
1996-12-11  0:00   ` Dewi Daniels
1996-12-12  0:00     ` Richard Kenner
1996-12-17  0:00       ` Eric Miller
1996-12-18  0:00         ` Robert Dewar
1996-12-18  0:00           ` Robert A Duff
1996-12-19  0:00           ` Keith Thompson
1996-12-26  0:00             ` Robert Dewar
1996-12-11  0:00   ` Matthew Heaney
1996-12-12  0:00     ` Chris Brand
1996-12-13  0:00       ` Stephen Leake
1996-12-14  0:00         ` Robert A Duff
1996-12-14  0:00     ` BGaffney42 [this message]
1996-12-19  0:00   ` Robert I. Eachus
1996-11-27  0:00 Ensco Vendor
1996-11-27  0:00 ` Robert I. Eachus
1996-11-29  0:00 ` Robert Dewar
1996-12-01  0:00   ` Darel Cullen
1996-11-30  0:00     ` Robert Dewar
1996-12-11  0:00     ` Richard Riehle
1996-12-02  0:00 ` Ted Dennison
1996-12-10  0:00   ` Matthew Heaney
replies disabled

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