Просмотр исходного кода

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 лет назад
Родитель
Сommit
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;
 		else break;
 	}
 	}
-	sq_pushinteger(v, -1);
+	sq_pushinteger(v, imid > 0 ? -imid : -1);
 	return 1;
 	return 1;
 }
 }