1993.11.01 18:52 "Re: Patch (for Windows, but general)", by Richard Minner
#ifdef _WINDOWS
/*
* 64K segment pointer arithmetic! Yuk!
* Subtracting a value from a pointer can easily become
* negative, but with a segment:offset pointer the
* offset is unsigned and thus wraps around.
*
* So instead we'll compute the index to the location.
*/
if ( (h -= disp) < 0 )
h += HSIZE;
hp = &sp->enc_hashtab[h];
#else
> if ((hp -= disp) < sp->enc_hashtab) ###
hp += HSIZE;
#endif
Actually, your fix is not just a "windows/x83" fix, per se. Rather, the original code is not portable and should be changed regardless. ANSI/ISO C (and C++ when it arrives) only guarantees comparison of pointers within** the same (array) object. I would expect (hope) that the change would entail no performance penalty on any modern system.
** Ok, or one past the end.
--
Richard Minner rtm@island.com {uunet,sun,well}!island!rtm
Island Graphics Corporation Sacramento, CA (916) 736-1323