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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,df89b5458de26ba2 X-Google-Attributes: gid103376,public From: "Jeff Creem" Subject: Re: Unsigned Longword Date: 1999/12/10 Message-ID: <82s247$cgc$1@pyrite.mv.net>#1/1 X-Deja-AN: 559182479 References: X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@mv.com X-Trace: pyrite.mv.net 944868295 12812 199.125.98.28 (10 Dec 1999 23:24:55 GMT) Organization: MV Communications, Inc. X-MSMail-Priority: Normal NNTP-Posting-Date: 10 Dec 1999 23:24:55 GMT Newsgroups: comp.lang.ada Date: 1999-12-10T23:24:55+00:00 List-Id: > Anyway, at the time I really wanted a 'true' 32 bit 'Unsigned Longword'. One > that went from 0..2**32-1, supported by associated +-/* operators. However, at > the time, both of the compilers (DEC and VADS) had System packages which > implemented unsigned longword as the Positive range of Integer, ie. 0..2**31-1. > (An understandable implementation on a twos complement machine). Thus a '+' > arithmetic operation which caused a result whose MSB was set to '1' caused a > constraint error. > > We tried various definitions of our own Unsigned_Longword, but soon succumbed > to the line of least resistance under the pressure of project timescales. Hence > we invented overloaded '+' functions that checked ranges, and privately used ' > -' if an addition would cause max_int to be exceeded. > > I'd like to ask this forum if there was/is a nicer way of implementing a 'true' > Unsigned Longword? > As far as the "was"...Probably not..It was a sometimes very painful result of many Ada 83 implementations (and it was very reasonable to hide behind the LRM on this issue but it certainly would have been possible to have unsigned 32 bit longs in a 32 bit HW environment in Ada 83 if the compiler provided a soft > 32 bit integer. As far as "is"..If you use Ada 95 use modular types.