decord/alpha/source/utils/Uint8ArrayUtils.tsx

53 lines
1.8 KiB
TypeScript
Raw Permalink Normal View History

2026-10-09 10:00:15 +00:00
// Module ID: 2048
// Function ID: 2049
// Name: Uint8ArrayUtils
2026-07-23 10:11:24 +00:00
// Dependencies: [2]
2026-07-29 08:29:29 +00:00
// Exports: addBit, hasBit, isSerializedUint8Array, isUint8Array, removeBit
2026-07-20 16:05:17 +00:00
2026-10-09 10:00:15 +00:00
// Module 2048 (Uint8ArrayUtils)
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
let result = size.fileFinishedImporting("utils/Uint8ArrayUtils.tsx");
2026-07-29 08:29:29 +00:00
export const hasBit = function hasBit(dismissedContents, CHANNEL_NOTICE_INVITE) {
2026-07-20 16:05:17 +00:00
let tmp = 0 !== dismissedContents.length;
if (tmp) {
const _Math = Math;
tmp = dismissedContents[Math.floor(Math, CHANNEL_NOTICE_INVITE / 8)] & 1 << CHANNEL_NOTICE_INVITE % 8;
2026-07-20 16:05:17 +00:00
}
return tmp;
2026-07-29 08:29:29 +00:00
};
export const addBit = function addBit(dismissedContents, CHANNEL_NOTICE_INVITE) {
const rounded = Math.floor(CHANNEL_NOTICE_INVITE / 8);
2026-07-20 16:05:17 +00:00
let tmp2 = dismissedContents;
if (dismissedContents.length <= rounded) {
const _Uint8Array = Uint8Array;
2026-10-03 08:58:59 +00:00
const self = this;
const self2 = this;
2026-07-20 16:05:17 +00:00
const uint8Array = new Uint8Array(rounded + 1);
const result = uint8Array.set(dismissedContents, 0);
tmp2 = uint8Array;
}
2026-07-29 08:29:29 +00:00
tmp2[rounded] = tmp2[rounded] | 1 << CHANNEL_NOTICE_INVITE % 8;
2026-07-20 16:05:17 +00:00
return tmp2;
};
2026-07-29 08:29:29 +00:00
export const removeBit = function removeBit(dismissedContents, arg1) {
let tmp = 0 !== dismissedContents.length;
if (tmp) {
2026-07-20 16:05:17 +00:00
const _Math = Math;
2026-07-29 08:29:29 +00:00
tmp = dismissedContents[Math.floor(Math, arg1 / 8)] & 1 << arg1 % 8;
}
if (tmp) {
const _Math2 = Math;
const rounded = Math.floor(arg1 / 8);
dismissedContents[rounded] = dismissedContents[rounded] & ~1 << arg1 % 8;
2026-07-20 16:05:17 +00:00
}
return dismissedContents;
};
export const isUint8Array = function isUint8Array(arg0) {
return arg0 instanceof Uint8Array;
};
export const isSerializedUint8Array = function isSerializedUint8Array(__tag__) {
2026-10-10 08:08:14 +00:00
return null != __tag__ && typeof __tag__ === "object" && "__tag__" in __tag__ && "uint8array" === __tag__.__tag__;
2026-07-20 16:05:17 +00:00
};