core: add FileTooLargeError

This commit is contained in:
undefined committed 2021-03-08 12:47:37 +08:00
1 parent 4a294f59a8
commit 1b53bfa2b4
8 files changed
+42 -27

No files matched your search

+9
View File
@@ -257,3 +257,12 @@ export namespace Time {
return constructedObjectId;
}
}
export const log2 = (val: bigint | number) => {
if (typeof val === 'bigint') {
// @ts-ignore
for (let i = 0n; ; i++) if (!(val >> i)) return +i.toString() - 1;
} else {
for (let i = 0; ; i++) if (!(val >> i)) return i - 1;
}
};