decord/source/utils/SortedArrayUtils.tsx

58 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 5003
// Function ID: 5004
2026-07-20 16:05:17 +00:00
// Name: insertionIndex
2026-07-23 10:11:24 +00:00
// Dependencies: [2]
2026-07-29 08:29:29 +00:00
// Exports: insert, insertionIndex
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 5003 (insertionIndex)
import set from "set" /* 2 */;
const result = set.fileFinishedImporting("utils/SortedArrayUtils.tsx");
2026-07-29 08:29:29 +00:00
export const insertionIndex = function insertionIndex(arg0, arg1, arg2) {
let sum;
let tmp4;
let length = arg0.length;
2026-07-20 16:05:17 +00:00
let num = 0;
let num2 = 0;
if (0 < length) {
do {
let tmp = num + length >>> 1;
2026-07-29 08:29:29 +00:00
let tmp2 = length;
sum = num;
tmp4 = tmp;
if (arg2(arg0[tmp], arg1) < 0) {
sum = tmp + 1;
tmp4 = length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
length = tmp4;
num = sum;
num2 = sum;
} while (sum < tmp4);
2026-07-20 16:05:17 +00:00
}
return num2;
2026-07-29 08:29:29 +00:00
};
2026-07-20 16:05:17 +00:00
export const insert = function insert(arr) {
2026-07-29 08:29:29 +00:00
let sum;
let tmp4;
let length = arr.length;
let num = 0;
let num2 = 0;
if (0 < length) {
do {
let tmp = num + length >>> 1;
let tmp2 = length;
sum = num;
tmp4 = tmp;
if (arg2(arr[tmp], arg1) < 0) {
sum = tmp + 1;
tmp4 = length;
}
length = tmp4;
num = sum;
num2 = sum;
} while (sum < tmp4);
}
arr.splice(num2, 0, arg1);
2026-07-20 16:05:17 +00:00
};