gpi-hash.c segfaults_(re)

Tue, 05 Aug 1997 09:37:30 +1100


On  4 Aug 97 at 18:14, Peter Gerwinski wrote:
> Not a slight, but a big problem: (i) See `../cccp.c', line 51; (ii)
> `ptrdiff_t', even if it exists, is a signed type, and GCC doesn't
> accept `unsigned ptrdiff_t'.  :-(

Ouch

> To work around, what about the following?  It only must produce a
> more-or-less unique number ...
> 
>     /* We must avoid negative values.  Naturally, we would cast this
>     to
>      * `unsigned ptrdiff_t', but since we cannot be sure that the
>      platform * we compile GPC on will support this, we use `abs'
>      instead. */
>     #define HASH_FUNC(NODE) ((abs ((NODE) - (tree) 0) >> 2) %
>     MAX_HASH_TABLE)

Looks good to me (other than the fact pegasus mangled the lines)

Bill
--
Leave others their otherness.


Bill Currie (billc@blackmagic.tait.co.nz)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es