add idz repository layer

This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent 6beb3b2343
commit 8817029258
39 changed files with 375 additions and 99 deletions
+15
View File
@@ -0,0 +1,15 @@
export function bitmap(buf: Buffer): number[] {
const result = new Array();
for (let byteNo = 0; byteNo < buf.length; byteNo++) {
const byte = buf.readUInt8(byteNo);
for (let bitNo = 0; bitNo < 8; bitNo++) {
if (byte & (1 << bitNo)) {
result.push(8 * byteNo + bitNo);
}
}
}
return result;
}