comp.lang.ada
 help / color / mirror / Atom feed
From: Kilgallen@SpamCop.net (Larry Kilgallen)
Subject: Re: Hashing on System.Address
Date: 14 Jun 2005 03:42:47 -0500
Date: 2005-06-14T03:42:47-05:00	[thread overview]
Message-ID: <Q32uBJZaej4r@eisner.encompasserve.org> (raw)
In-Reply-To: wcc3brlrfj5.fsf@shell01.TheWorld.com

In article <wcc3brlrfj5.fsf@shell01.TheWorld.com>, Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> "Matthew Heaney" <mheaney@on2.com> writes:
> 
>> Duncan Sands wrote:
>> > Does anyone have an efficient portable algorithm for hashing
>> > on a System.Address?
>> >
>> > The Ada 2005 package Ada.Containers defines Hash_Type as
>> >
>> > 	type Hash_Type is mod implementation-defined;
>> >
>> > This is the target type I would like for the hash.
>> 
>> Use System.Storage_Elements.To_Integer to convert the address to an
>> Integer_Address, and then convert that to type Hash_Type.
> 
> It might be a good idea to divide that by 8, since most addresses have
> zeros in the low three bits.

Or it might not be, since he said portable.  Looking at addresses of
_instructions_ (which are the closest to that pattern) on the machine
architectures on which VMS runs:

	VAX - No restriction, 1 bit (odd and even) just as likely to be
		one as the other
	Alpha - 4 byte boundary, 4 bit (100) just as likely to be one
		as the other
	Itanium - 8 byte boundary for VLIW instructions, but in software
		the last octet of the address is 0, 1 or 2 depending on
		which instruction in the bundle is addressed.



  parent reply	other threads:[~2005-06-14  8:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-13 20:18 Hashing on System.Address Duncan Sands
2005-06-13 21:31 ` Mark Lorenzen
2005-06-14  7:23   ` Duncan Sands
2005-06-14 20:18     ` Randy Brukardt
2005-06-15  7:27       ` Duncan Sands
2005-06-13 21:57 ` Matthew Heaney
2005-06-13 23:41   ` Robert A Duff
2005-06-14  2:22     ` Matthew Heaney
2005-06-14  7:27       ` Duncan Sands
2005-06-14  8:52         ` Alex R. Mosteo
2005-06-14  9:06           ` Duncan Sands
2005-06-14  9:09           ` Duncan Sands
2005-06-14 17:00             ` Pascal Obry
2005-06-14 20:03             ` Randy Brukardt
2005-06-14 23:20               ` Robert A Duff
2005-06-15  7:13               ` Duncan Sands
2005-06-14  8:44       ` Larry Kilgallen
2005-06-14 10:03       ` Marius Amado Alves
     [not found]       ` <abb2a2c53e3708803aa68bb87834b7bc@netcabo.pt>
2005-06-14 10:14         ` Duncan Sands
     [not found]         ` <200506141214.14213.baldrick@free.fr>
2005-06-14 10:29           ` Marius Amado Alves
     [not found]           ` <64f19b6707e4d19f5362900bbfb80b76@netcabo.pt>
2005-06-14 10:49             ` Marius Amado Alves
2005-06-14  8:42     ` Larry Kilgallen [this message]
2005-06-14 11:18     ` Duncan Sands
2005-06-14  7:18   ` Duncan Sands
2005-06-14 15:18     ` Matthew Heaney
2005-06-14 16:22       ` Duncan Sands
replies disabled

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