decord/source/utils/SortedArrayUtils.tsx
2026-07-24 07:16:23 +00:00

32 lines
727 B
TypeScript

// Module ID: 4805
// Function ID: 41874
// Name: insertionIndex
// Dependencies: [2]
// Exports: insert
// Module 4805 (insertionIndex)
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;
}
const result = require("set").fileFinishedImporting("utils/SortedArrayUtils.tsx");
export { insertionIndex };
export const insert = function insert(arr) {
arr.splice(insertionIndex(arr, arg1, arg2), 0, arg1);
};