[m-dev.] For review: hash table implementation

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Feb 4 06:41:43 AEDT 2001


On 01-Feb-2001, Ralph Becket <rbeck at microsoft.com> wrote:
>     % XXX Need to check that N is not too great, either.
>     %
> new(HashPred, N, MaxOccupancy) = HT :-
>     (      if N =< 1 then
>             throw("hash_table__new_hash_table: N =< 1")

It would be nice to fix that XXX.
I think something like the following

            else if N >= int__bits_per_int then
             throw("hash_table__new_hash_table: N >= int__bits_per_int")

should do the trick.

> int_hash_pred =
>     ( pred(N::in, H1::out, H2::out) is det :-
>         H1 = N * N,
>         H2 = N `xor` (N + N)
>     ).

Why not just `H1 = N'?

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
                                    |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list