comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeff Creem" <jcreem@atetola.mv.com>
Subject: Re: Unsigned Longword
Date: 1999/12/10
Date: 1999-12-10T23:24:55+00:00	[thread overview]
Message-ID: <82s247$cgc$1@pyrite.mv.net> (raw)
In-Reply-To: OF8A70EE05.EDBCEFED-ON88256843.0079C931@ray.ca

> 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.








  parent reply	other threads:[~1999-12-10  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-10  0:00 Unsigned Longword Tom_Hargraves
1999-12-10  0:00 ` Matthew Heaney
1999-12-10  0:00 ` Jeff Creem [this message]
1999-12-11  0:00 ` Ed Falis
replies disabled

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