The implementation is pretty straightforward, and doesn't yet match
perl5's implementation.

Inserting a key:

1) Hash the key to a number, and fold it to between 0 and NUM_BUCKETS.
2) Create a new bucket, and save both the value and key in it.
3) Tack the bucket onto the appropriate hash index.

Finding a key:

1) Hash the key to a number, and fold it to between 0 and NUM_BUCKETS
2) Go to the appropriate hash index.
3) Walk the list of buckets looking for the appropriate key.
4) If it's been found, return the value.

TODO:

PerlArray and PerlHash can't store PMCs as values yet.
PerlHash doesn't quite correspond to the Perl5 algorithm, inasmuch as it
deals with a fixed number of buckets. It should check the number of
buckets in use, and once it surpasses an arbitrary limit, double the
number of buckets and rehash the key list.

More severe testing. I've personally tested it with 255 different
key/value combinations, and it stored and retrieved values properly.
Given the fact that there are 128 buckets, it's obviously using bucket
overflow.

I'll be doing more testing later on, and fixing what bugs I find later
on this week.

--
Jeff <[EMAIL PROTECTED]>

Reply via email to