swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HashTable?


From: Ralf Stephan
Subject: Re: HashTable?
Date: Tue, 30 May 2000 11:14:04 +0200

MGD:
> RS> Although it's probably not intended, I'd like to use
> RS> tclobjc/HashTable.* in my sources. 
> 
> Oy, how about the avl* routines in misc/ instead?

That (as well as Map) isn't O(1) for lookup with string keys, AFAIK.

You see, it's table versus tree.  The other reasons would be, well,
HashTable already has an Obj-C interface, and its own hashfunc (from
what I see in the libobjc source), although it's not quite of the
form I expected --- anyone care to comment on the func given below[*]?

The whole issue changes, of course, if you work in parallel.  Is this
your concern with my using HashTable?


ralf
PS:[*] From <objc/hash.h>:

static inline unsigned int 
hash_string (cache_ptr cache, const void *key)
{
  unsigned int ret = 0;
  unsigned int ctr = 0;
        
        
  while (*(char*)key) {
    ret ^= *(char*)key++ << ctr;
    ctr = (ctr + 1) % sizeof (void *);
  }

  return ret & cache->mask;
}
-- 
http://ME.IN-berlin.de/~rws/

                  ==================================
   Swarm-Support is for discussion of the technical details of the day
   to day usage of Swarm.  For list administration needs (esp.
   [un]subscribing), please send a message to <address@hidden>
   with "help" in the body of the message.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]