comp.lang.ada
 help / color / mirror / Atom feed
* Unsigned Longword
@ 1999-12-10  0:00 Tom_Hargraves
  1999-12-10  0:00 ` Matthew Heaney
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tom_Hargraves @ 1999-12-10  0:00 UTC (permalink / raw)
  To: comp.lang.ada



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.









^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-12-11  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-10  0:00 Unsigned Longword Tom_Hargraves
1999-12-10  0:00 ` Matthew Heaney
1999-12-10  0:00 ` Jeff Creem
1999-12-11  0:00 ` Ed Falis

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