X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=hv.h;h=16b14828e2a9c3b568cd5e288c84503085104cc1;hb=b13c494218827599481238f7c7f4125dd056dce1;hp=6dc0a88f5b07a2120e76b69f4e3fae294d000994;hpb=e16e2ff836b177c52744755a35f12e818d01328b;p=p5sagit%2Fp5-mst-13.2.git diff --git a/hv.h b/hv.h index 6dc0a88..16b1482 100644 --- a/hv.h +++ b/hv.h @@ -47,12 +47,19 @@ struct xpvhv { }; /* hash a key */ -/* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins */ -/* from requirements by Colin Plumb. */ -/* (http://burtleburtle.net/bob/hash/doobs.html) */ +/* FYI: This is the "One-at-a-Time" algorithm by Bob Jenkins + * from requirements by Colin Plumb. + * (http://burtleburtle.net/bob/hash/doobs.html) */ +/* The use of a temporary pointer and the casting games + * is needed to serve the dual purposes of + * (a) the hashed data being interpreted as "unsigned char" (new since 5.8, + * a "char" can be either signed or signed, depending on the compiler) + * (b) catering for old code that uses a "char" + */ #define PERL_HASH(hash,str,len) \ STMT_START { \ - register const char *s_PeRlHaSh = str; \ + register const char *s_PeRlHaSh_tmp = str; \ + register const unsigned char *s_PeRlHaSh = (const unsigned char *)s_PeRlHaSh_tmp; \ register I32 i_PeRlHaSh = len; \ register U32 hash_PeRlHaSh = 0; \ while (i_PeRlHaSh--) { \