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,XPRIO autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,df89b5458de26ba2,start X-Google-Attributes: gid103376,public From: Tom_Hargraves@Raytheon.com Subject: Unsigned Longword Date: 1999/12/10 Message-ID: #1/1 X-Deja-AN: 559171668 X-MIMETrack: Serialize by Router on RESMAIL70/SRV/Raytheon/CA(Release 5.0.1b|September 30, 1999) at 12/10/1999 02: 56:02 PM To: comp.lang.ada@ada.eu.org X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@enst.fr X-Trace: menuisier.enst.fr 944866608 32355 137.194.161.2 (10 Dec 1999 22:56:48 GMT) Organization: ENST, France X-BeenThere: comp.lang.ada@ada.eu.org Mime-Version: 1.0 Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Date: 10 Dec 1999 22:56:48 GMT Newsgroups: comp.lang.ada Date: 1999-12-10T22:56:48+00:00 List-Id: Please consider yourself in a 32 bit hardware architectural world for the purposes of this query :-) I remember a couple of years ago having to do bits-and-bytes transfers between different endian processors via a VME shared memory area. Not something to be undertaken lightly, whether in Ada or any other language... 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? Yours curiously, Tom H.