modelize titles and backgrounds
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
export function bitmap(items: number[], nbytes: number): Buffer {
|
||||
const buf = Buffer.alloc(nbytes);
|
||||
|
||||
for (const item of items) {
|
||||
const byte = (item / 8) | 0;
|
||||
const bit = item % 8;
|
||||
|
||||
buf.writeUInt8(buf.readUInt8(byte) | (1 << bit), byte);
|
||||
}
|
||||
|
||||
return buf;
|
||||
}
|
||||
Reference in New Issue
Block a user