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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,68e7d264bfe3bcbf X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-09-23 19:36:23 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!newsgate.watson.ibm.com!watnews.watson.ibm.com!ncohen From: ncohen@watson.ibm.com (Norman H. Cohen) Newsgroups: comp.lang.ada Subject: Re: 64 bit integer support as native type Date: 23 Sep 1994 16:09:15 GMT Organization: IBM T.J. Watson Research Center Distribution: world Message-ID: <35uujb$185r@watnews1.watson.ibm.com> References: <35setv$7nq@walters.East.Sun.COM> Reply-To: ncohen@watson.ibm.com NNTP-Posting-Host: rios8.watson.ibm.com Date: 1994-09-23T16:09:15+00:00 List-Id: In article <35setv$7nq@walters.East.Sun.COM>, brent@paisley.East.Sun.COM (Brent Slone) writes: |> Does the Ada LRM define a 64 bit integer? No, but then again, it wouldn't. Implementations, not the LRM, define the ranges of integer types they support. |> If not, what is the most |> straightforward method for implementing 64 bit ints? A programmer can declare an integer type with the range of conventional 64-bit twos complement as follows: type Integer_64 is range -2**63 .. 2**63-1; One of three things may happen as a result of this declaration: o You may get object code that efficiently exploits the 64-bit registers of your target machine. o You may get code that performs 64-bit arithmetic in software, for example storing an Integer_64 value in a pair of registers and turning an addition into an add-setting-carry-bit instruction for the low-order registers in each pair, followed by an add-two-registers-plus-carry-bit instruction for the high-order registers in each pair. o You may get an error message stating that your compiler does not support integer types with so large a range. In any event, you are guaranteed that if the compiler accepts the declaration, the type will support the semantics of 64-bit 2's-complement integers. (I can already hear Robert Dewar saying, "There you go again, Norman!" His displeasure with defining types in terms of presumed hardware constraints rather than the ranges of values needed to solve the problem at hand is certainly valid, but you posed a requirement for 64-bit integers, so I'm assuming that that is your application's requirement. Since just about all machines not manufactured in Minnesota have word sizes of 16, 32, or 64 bytes, and since some programs have a need to deal with hardware, hardware-inspired file formats, or interfaces to other software, it is not all that unreasonable for "64-bit integer" to arise as an abstract software requirement.) -- Norman H. Cohen ncohen@watson.ibm.com