diff options
| -rw-r--r-- | lapi.c | 2 | ||||
| -rw-r--r-- | lauxlib.c | 9 | ||||
| -rw-r--r-- | lmathlib.c | 2 | ||||
| -rw-r--r-- | ltable.c | 3 |
4 files changed, 10 insertions, 6 deletions
| @@ -1221,7 +1221,7 @@ LUA_API int lua_gc (lua_State *L, int what, ...) { | |||
| 1221 | int param = va_arg(argp, int); | 1221 | int param = va_arg(argp, int); |
| 1222 | int value = va_arg(argp, int); | 1222 | int value = va_arg(argp, int); |
| 1223 | api_check(L, 0 <= param && param < LUA_GCPN, "invalid parameter"); | 1223 | api_check(L, 0 <= param && param < LUA_GCPN, "invalid parameter"); |
| 1224 | res = luaO_applyparam(g->gcparams[param], 100); | 1224 | res = cast_int(luaO_applyparam(g->gcparams[param], 100)); |
| 1225 | if (value >= 0) | 1225 | if (value >= 0) |
| 1226 | g->gcparams[param] = luaO_codeparam(value); | 1226 | g->gcparams[param] = luaO_codeparam(value); |
| 1227 | break; | 1227 | break; |
| @@ -1131,8 +1131,11 @@ static void warnfon (void *ud, const char *message, int tocont) { | |||
| 1131 | /* Size for the buffer in int's, rounded up */ | 1131 | /* Size for the buffer in int's, rounded up */ |
| 1132 | #define BUFSEED ((BUFSEEDB + sizeof(int) - 1) / sizeof(int)) | 1132 | #define BUFSEED ((BUFSEEDB + sizeof(int) - 1) / sizeof(int)) |
| 1133 | 1133 | ||
| 1134 | 1134 | /* | |
| 1135 | #define addbuff(b,v) (memcpy(b, &(v), sizeof(v)), b += sizeof(v)) | 1135 | ** Copy the contents of variable 'v' into the buffer pointed by 'b'. |
| 1136 | ** (The '&b[0]' disguises 'b' to fix an absurd warning from clang.) | ||
| 1137 | */ | ||
| 1138 | #define addbuff(b,v) (memcpy(&b[0], &(v), sizeof(v)), b += sizeof(v)) | ||
| 1136 | 1139 | ||
| 1137 | 1140 | ||
| 1138 | static unsigned int luai_makeseed (void) { | 1141 | static unsigned int luai_makeseed (void) { |
| @@ -1146,7 +1149,7 @@ static unsigned int luai_makeseed (void) { | |||
| 1146 | /* fill (rare but possible) remain of the buffer with zeros */ | 1149 | /* fill (rare but possible) remain of the buffer with zeros */ |
| 1147 | memset(b, 0, sizeof(buff) - BUFSEEDB); | 1150 | memset(b, 0, sizeof(buff) - BUFSEEDB); |
| 1148 | res = buff[0]; | 1151 | res = buff[0]; |
| 1149 | for (i = 0; i < BUFSEED; i++) | 1152 | for (i = 1; i < BUFSEED; i++) |
| 1150 | res ^= (res >> 3) + (res << 7) + buff[i]; | 1153 | res ^= (res >> 3) + (res << 7) + buff[i]; |
| 1151 | return res; | 1154 | return res; |
| 1152 | } | 1155 | } |
| @@ -352,7 +352,7 @@ static lua_Number I2d (Rand64 x) { | |||
| 352 | SRand64 sx = (SRand64)(trim64(x) >> shift64_FIG); | 352 | SRand64 sx = (SRand64)(trim64(x) >> shift64_FIG); |
| 353 | lua_Number res = (lua_Number)(sx) * scaleFIG; | 353 | lua_Number res = (lua_Number)(sx) * scaleFIG; |
| 354 | if (sx < 0) | 354 | if (sx < 0) |
| 355 | res += 1.0; /* correct the two's complement if negative */ | 355 | res += l_mathop(1.0); /* correct the two's complement if negative */ |
| 356 | lua_assert(0 <= res && res < 1); | 356 | lua_assert(0 <= res && res < 1); |
| 357 | return res; | 357 | return res; |
| 358 | } | 358 | } |
| @@ -995,7 +995,8 @@ static int finishnodeset (Table *t, const TValue *slot, TValue *val) { | |||
| 995 | } | 995 | } |
| 996 | else if (isabstkey(slot)) | 996 | else if (isabstkey(slot)) |
| 997 | return HNOTFOUND; /* no slot with that key */ | 997 | return HNOTFOUND; /* no slot with that key */ |
| 998 | else return (cast(Node*, slot) - t->node) + HFIRSTNODE; /* node encoded */ | 998 | else /* return node encoded */ |
| 999 | return cast_int((cast(Node*, slot) - t->node)) + HFIRSTNODE; | ||
| 999 | } | 1000 | } |
| 1000 | 1001 | ||
| 1001 | 1002 | ||
