瀏覽代碼

Changed the return value of array.bsearch to the negative value of the last possible match (-imid) instead of constant -1 when not found.

mingodad 12 年之前
父節點
當前提交
91cf03d04b
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      SquiLu/squirrel/sqbaselib.cpp

+ 1 - 1
SquiLu/squirrel/sqbaselib.cpp

@@ -833,7 +833,7 @@ static SQRESULT array_bsearch(HSQUIRRELVM v)
 		}
 		else break;
 	}
-	sq_pushinteger(v, -1);
+	sq_pushinteger(v, imid > 0 ? -imid : -1);
 	return 1;
 }