decord/source/utils/SortedArrayUtils.tsx

33 lines
727 B
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 4806
2026-07-27 11:26:19 +00:00
// Function ID: 41887
2026-07-20 16:05:17 +00:00
// Name: insertionIndex
2026-07-23 10:11:24 +00:00
// Dependencies: [2]
2026-07-20 16:05:17 +00:00
// Exports: insert
2026-07-25 08:10:48 +00:00
// Module 4806 (insertionIndex)
2026-07-20 16:05:17 +00:00
function insertionIndex(arr, arg1, arg2) {
let tmp2;
let length = arr.length;
let num = 0;
let num2 = 0;
if (0 < length) {
do {
let tmp = num + length >>> 1;
tmp2 = tmp;
if (arg2(arr[tmp], arg1) < 0) {
num = tmp + 1;
tmp2 = length;
}
length = tmp2;
num2 = num;
} while (num < tmp2);
}
return num2;
}
2026-07-23 10:11:24 +00:00
const result = require("set").fileFinishedImporting("utils/SortedArrayUtils.tsx");
2026-07-20 16:05:17 +00:00
export { insertionIndex };
export const insert = function insert(arr) {
arr.splice(insertionIndex(arr, arg1, arg2), 0, arg1);
};