diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-11 18:23:01 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2002-01-11 18:23:01 -0200 |
commit | b7ae43d457ca7b5a46ca768f482b334d70897a14 (patch) | |
tree | 0f47c94c9ee6ac5ab21b7bf3c1495f1f42d55889 | |
parent | f083812c020186d0d919833100c1a0b6eda8c2c0 (diff) | |
download | lua-b7ae43d457ca7b5a46ca768f482b334d70897a14.tar.gz lua-b7ae43d457ca7b5a46ca768f482b334d70897a14.tar.bz2 lua-b7ae43d457ca7b5a46ca768f482b334d70897a14.zip |
detail
-rw-r--r-- | llimits.h | 5 | ||||
-rw-r--r-- | lstring.c | 2 |
2 files changed, 4 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.33 2001/10/02 16:45:03 roberto Exp $ | 2 | ** $Id: llimits.h,v 1.1 2001/11/29 22:14:34 rieru Exp rieru $ |
3 | ** Limits, basic types, and some other `installation-dependent' definitions | 3 | ** Limits, basic types, and some other `installation-dependent' definitions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -45,7 +45,8 @@ typedef unsigned int lu_hash; | |||
45 | /* its signed equivalent */ | 45 | /* its signed equivalent */ |
46 | typedef int ls_hash; | 46 | typedef int ls_hash; |
47 | 47 | ||
48 | /* an unsigned integer big enough to count the total memory used by Lua */ | 48 | /* an unsigned integer big enough to count the total memory used by Lua; */ |
49 | /* it should be at least as large as size_t */ | ||
49 | typedef unsigned long lu_mem; | 50 | typedef unsigned long lu_mem; |
50 | 51 | ||
51 | /* an integer big enough to count the number of strings in use */ | 52 | /* an integer big enough to count the number of strings in use */ |
@@ -68,7 +68,7 @@ static TString *newlstr (lua_State *L, const char *str, size_t l, lu_hash h) { | |||
68 | 68 | ||
69 | TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | 69 | TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { |
70 | TString *ts; | 70 | TString *ts; |
71 | lu_hash h = l; /* seed */ | 71 | lu_hash h = (lu_hash)l; /* seed */ |
72 | size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ | 72 | size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ |
73 | size_t l1; | 73 | size_t l1; |
74 | for (l1=l; l1>=step; l1-=step) /* compute hash */ | 74 | for (l1=l; l1>=step; l1-=step) /* compute hash */ |