comp.lang.ada
 help / color / mirror / Atom feed
From: "Matthew Heaney" <matthew_heaney@acm.org>
Subject: Re: Unsigned Longword
Date: 1999/12/10
Date: 1999-12-10T00:00:00+00:00	[thread overview]
Message-ID: <3851ca05_3@news1.prserv.net> (raw)
In-Reply-To: OF8A70EE05.EDBCEFED-ON88256843.0079C931@ray.ca

In article <OF8A70EE05.EDBCEFED-ON88256843.0079C931@ray.ca> , 
Tom_Hargraves@Raytheon.com  wrote:

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

VADS had a package called Unsigned_Types (or something like that) that
included true unsigned integers all the way up to and including 32 bits.
When you with'd that package, this turned on compiler magic, effectively
extending the language.


> I'd like to ask this forum if there was/is a nicer way of implementing a
> 'true' Unsigned Longword?

You could try suppressing overflow on the type:

  type Unsigned_Integer is new Integer;
  pragma Suppress (Overflow_Check, On => Unsigned_Integer);


--
The theory of evolution is quite rightly called the greatest unifying
theory in biology.  The diversity of organisms, similarities and
differences between kinds of organisms, patterns of distribution and
behavior, adaptation and interaction, all this was merely a bewildering
chaos of facts until given meaning by the evolutionary theory.

Populations, Species, and Evolution
Ernst Mayr




  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 [this message]
1999-12-10  0:00 ` Jeff Creem
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