comp.lang.ada
 help / color / mirror / Atom feed
* Hashing Algorithms
@ 1996-03-25  0:00 David Wallace
  1996-03-25  0:00 ` Norman H. Cohen
  1996-03-25  0:00 ` Robert Dewar
  0 siblings, 2 replies; 4+ messages in thread
From: David Wallace @ 1996-03-25  0:00 UTC (permalink / raw)


Ia working currently with a Design Issue which requiresbthe use of a hashing 
algorithm for a string to an integer.

I have seen a couple of algorithms, however due to their nature would not be
allowed to incorporate them in to the software.

Could anybody point out the source of some hashing algorithms, which are
quick and do not use unchecked conversion within them. If not, I will just have
to reinvent the wheel and write one myself.

Thanks

     Dave Wallace
-- 
--. --. --. --. : : --- --- .---------------------------------------------.
|_| |_| | _ | | | | |_   |  |Internet provider for all Acorn RISC machines|
| | |\  | | | | |\| |    |  '---------------------------------------------'
| | | \ |_| |_| | | |__  |  averon@argonet.co.uk





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

* Re: Hashing Algorithms
  1996-03-25  0:00 Hashing Algorithms David Wallace
@ 1996-03-25  0:00 ` Norman H. Cohen
  1996-03-25  0:00   ` Robert A Duff
  1996-03-25  0:00 ` Robert Dewar
  1 sibling, 1 reply; 4+ messages in thread
From: Norman H. Cohen @ 1996-03-25  0:00 UTC (permalink / raw)


In article <internews46B4920C5E@argonet.co.uk>, David Wallace
<averon@argonet.co.uk> writes: 

|> Ia working currently with a Design Issue which requiresbthe use of a hashing
|> algorithm for a string to an integer.
|>
|> I have seen a couple of algorithms, however due to their nature would not be
|> allowed to incorporate them in to the software.

Does "due to their nature" mean "due to the fact that they use unchecked
conversion"?

|> Could anybody point out the source of some hashing algorithms, which are
|> quick and do not use unchecked conversion within them. If not, I will just have
|> to reinvent the wheel and write one myself.

1. If your goal is to treat a character as a numeric value, you don't
   need unchecked conversion.  Just use Character'Pos.

2. I think I smell a silly coding rule.  While unchecked conversion,
   should, in general, be used with caution, there are circumstances in
   which its use is appropriate and perhaps even unavoidable.  For
   example, if you were building a hash table of trees to ensure that
   there is a unique copy of each subtree ever constructed, it would be
   appropriate to hash access values pointing to tree nodes by
   uncheckedly converting them to some integer type.

--
Norman H. Cohen    ncohen@watson.ibm.com




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

* Re: Hashing Algorithms
  1996-03-25  0:00 Hashing Algorithms David Wallace
  1996-03-25  0:00 ` Norman H. Cohen
@ 1996-03-25  0:00 ` Robert Dewar
  1 sibling, 0 replies; 4+ messages in thread
From: Robert Dewar @ 1996-03-25  0:00 UTC (permalink / raw)


David Wallace said

"Ia working currently with a Design Issue which requiresbthe use of a hashing
algorithm for a string to an integer.

I have seen a couple of algorithms, however due to their nature would not be
allowed to incorporate them in to the software.

Could anybody point out the source of some hashing algorithms, which are
quick and do not use unchecked conversion within them. If not, I will just have
to reinvent the wheel and write one myself."

Try looking in the GNAT sources, look at the general hash table routines
in the Gnat hierarchy, and the hash routine used by the Namet compiler
unit. Isn't it nice to have sources available?





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

* Re: Hashing Algorithms
  1996-03-25  0:00 ` Norman H. Cohen
@ 1996-03-25  0:00   ` Robert A Duff
  0 siblings, 0 replies; 4+ messages in thread
From: Robert A Duff @ 1996-03-25  0:00 UTC (permalink / raw)


In article <4j72g2$lbn@watnews1.watson.ibm.com>,
Norman H. Cohen <ncohen@watson.ibm.com> wrote:
> ...For
>   example, if you were building a hash table of trees to ensure that
>   there is a unique copy of each subtree ever constructed, it would be
>   appropriate to hash access values pointing to tree nodes by
>   uncheckedly converting them to some integer type.

Beware garbage collectors that move things around in memory.

- Bob




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

end of thread, other threads:[~1996-03-25  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-03-25  0:00 Hashing Algorithms David Wallace
1996-03-25  0:00 ` Norman H. Cohen
1996-03-25  0:00   ` Robert A Duff
1996-03-25  0:00 ` Robert Dewar

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