Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 1x 1x 1x 1x 1x 1x 4x 4x 4x 4x 676x 676x 676x 676x 676x 676x 676x 1016x 1016x 1016x 1016x 1016x 1016x 1016x 1016x 291x 1016x 725x 725x 725x 1016x 676x 4x 4x 4x | const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_";
/**
* @_ignore
*/
export function decodeBits(width: number, data: string): Array<number> {
const maxValue = (1 << width) - 1;
const result: Array<number> = [ ];
let accum = 0, bits = 0, flood = 0;
for (let i = 0; i < data.length; i++) {
// Accumulate 6 bits of data
accum = ((accum << 6) | Base64.indexOf(data[i]));
bits += 6;
// While we have enough for a word...
while (bits >= width) {
// ...read the word
const value = (accum >> (bits - width));
accum &= (1 << (bits - width)) - 1;
bits -= width;
// A value of 0 indicates we exceeded maxValue, it
// floods over into the next value
if (value === 0) {
flood += maxValue;
} else {
result.push(value + flood);
flood = 0;
}
}
}
return result;
}
|