summaryrefslogtreecommitdiff
path: root/Build/source/libs/luajit/LuaJIT-2.0.3
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:23:43 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2014-06-18 11:23:43 +0000
commitc594597e3480253f361154c71491adf03bc896d3 (patch)
tree4f656c0861c6ccf00118df41fc5e224bfc4e31b9 /Build/source/libs/luajit/LuaJIT-2.0.3
parent352dcc581b20e25d7cc394cf602b3617cd305369 (diff)
LuaTeX: Somewhat better handling of Lua52/LuaJIT
git-svn-id: svn://tug.org/texlive/trunk@34278 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/luajit/LuaJIT-2.0.3')
-rw-r--r--Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c b/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c
index 62ad5e891f5..b5fd45e5004 100644
--- a/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c
+++ b/Build/source/libs/luajit/LuaJIT-2.0.3/src/lj_str.c
@@ -90,6 +90,14 @@ void lj_str_resize(lua_State *L, MSize newmask)
g->strhash = newhash;
}
+/*
+** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to
+** compute its hash
+*/
+#if !defined(LUAI_HASHLIMIT)
+#define LUAI_HASHLIMIT 5
+#endif
+
#define cast(t, exp) ((t)(exp))
int luajittex_choose_hash_function = 0 ;
/* Intern a string and return string object. */
@@ -111,7 +119,7 @@ GCstr *lj_str_new(lua_State *L, const char *str, size_t lenx)
if (luajittex_choose_hash_function==0) {
/* Lua 5.1.5 hash function */
/* for 5.2 max methods we also need to patch the vm eq */
- step = (len>>6)+1; /* if string is too long, don't hash all its chars Was 5, we try 6*/
+ step = (len>>LUAI_HASHLIMIT)+1; /* if string is too long, don't hash all its chars */
for (l1=len; l1>=step; l1-=step) /* compute hash */
h = h ^ ((h<<5)+(h>>2)+cast(unsigned char, str[l1-1]));
} else {