small optimization for i..''
This commit is contained in:
12
lvm.c
12
lvm.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lvm.c,v 1.94 2000/03/10 14:38:10 roberto Exp roberto $
|
** $Id: lvm.c,v 1.95 2000/03/10 18:37:44 roberto Exp roberto $
|
||||||
** Lua virtual machine
|
** Lua virtual machine
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -258,18 +258,14 @@ int luaV_lessthan (lua_State *L, const TObject *l, const TObject *r, StkId top)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define setbool(o,cond) if (cond) { \
|
|
||||||
ttype(o) = TAG_NUMBER; nvalue(o) = 1.0; } \
|
|
||||||
else ttype(o) = TAG_NIL
|
|
||||||
|
|
||||||
|
|
||||||
static void strconc (lua_State *L, int total, StkId top) {
|
static void strconc (lua_State *L, int total, StkId top) {
|
||||||
do {
|
do {
|
||||||
int n = 2; /* number of elements handled in this pass (at least 2) */
|
int n = 2; /* number of elements handled in this pass (at least 2) */
|
||||||
if (tostring(L, top-2) || tostring(L, top-1))
|
if (tostring(L, top-2) || tostring(L, top-1))
|
||||||
call_binTM(L, top, IM_CONCAT, "unexpected type for concatenation");
|
call_binTM(L, top, IM_CONCAT, "unexpected type for concatenation");
|
||||||
else { /* at least two string values; get as many as possible */
|
else if (tsvalue(top-1)->u.s.len > 0) { /* if len=0, do nothing */
|
||||||
long tl = tsvalue(top-2)->u.s.len + tsvalue(top-1)->u.s.len;
|
/* at least two string values; get as many as possible */
|
||||||
|
long tl = tsvalue(top-1)->u.s.len + tsvalue(top-2)->u.s.len;
|
||||||
char *buffer;
|
char *buffer;
|
||||||
int i;
|
int i;
|
||||||
while (n < total && !tostring(L, top-n-1)) { /* collect total length */
|
while (n < total && !tostring(L, top-n-1)) { /* collect total length */
|
||||||
|
|||||||
Reference in New Issue
Block a user