Verified Commit 3fb05564 authored by Samuel Elliott's avatar Samuel Elliott
Browse files

Support shifting extra bits

parent 7aecfb33
Pipeline #797 failed with stages
in 1 minute and 39 seconds
......@@ -436,9 +436,7 @@ export function encodeBlock(bytes_block: Buffer, alphabet: Alphabet = BASE62_ALP
let bytes_int = BigInt('0x' + bytes_block.toString('hex'));
if (shift) {
let n = 1;
for (let i = 0; i > extra; i++) n = n * 2;
bytes_int = bytes_int * BigInt(n);
bytes_int <<= BigInt(extra);
}
const alphabet_size = BigInt(alphabet.length);
......@@ -474,7 +472,7 @@ export function decodeBlock(chars_block: string, alphabet: Alphabet = BASE62_ALP
}
if (shift) {
// TODO
bytes_int >>= BigInt(extra);
}
return Buffer.from(bytes_int.toString(16)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment