mirror of
https://github.com/tiramisulabs/seyfert.git
synced 2025-07-02 21:16:09 +00:00
15 lines
384 B
TypeScript
15 lines
384 B
TypeScript
/**
|
|
* Memory optimizations
|
|
* All credits to the Discordeno authors
|
|
*/
|
|
|
|
export function iconHashToBigInt(hash: string) {
|
|
return BigInt("0x" + (hash.startsWith("a_") ? `a${hash.substring(2)}` : `b${hash}`));
|
|
}
|
|
|
|
export function iconBigintToHash(icon: bigint) {
|
|
const hash = icon.toString(16);
|
|
|
|
return hash.startsWith("a") ? `a_${hash.substring(1)}` : hash.substring(1);
|
|
}
|