commit c94f11d783f617af701429bb9ebfc7fc96d6a2d9
parent 54ac5960a800c32d7d9824d15b14a31131301678
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 26 Jun 2014 13:17:10 -0300
'IntPoint' -> 'point2int' + ensure that casted value fits in
destination type
Diffstat:
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/llimits.h b/llimits.h
@@ -1,5 +1,5 @@
/*
-** $Id: llimits.h,v 1.115 2014/04/15 14:28:20 roberto Exp roberto $
+** $Id: llimits.h,v 1.116 2014/04/15 16:32:49 roberto Exp roberto $
** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h
*/
@@ -44,11 +44,11 @@ typedef unsigned char lu_byte;
/*
-** conversion of pointer to integer
+** conversion of pointer to integer:
** this is for hashing only; there is no problem if the integer
** cannot hold the whole pointer value
*/
-#define IntPoint(p) ((unsigned int)(lu_mem)(p))
+#define point2int(p) ((unsigned int)((lu_mem)(p) & UINT_MAX))
diff --git a/ltable.c b/ltable.c
@@ -1,5 +1,5 @@
/*
-** $Id: ltable.c,v 2.89 2014/05/26 17:10:22 roberto Exp roberto $
+** $Id: ltable.c,v 2.90 2014/06/18 22:59:29 roberto Exp roberto $
** Lua tables (hash)
** See Copyright Notice in lua.h
*/
@@ -64,7 +64,7 @@
#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1))))
-#define hashpointer(t,p) hashmod(t, IntPoint(p))
+#define hashpointer(t,p) hashmod(t, point2int(p))
#define dummynode (&dummynode_)