bitSet2byte static method
Implementation
static Uint8List bitSet2byte(IsoBitSet bitSet, [int? bytes]) {
final int byteCount = bytes ?? (bitSet.length + 62 >> 6 << 6) >> 3;
final int length = byteCount * 8;
final Uint8List out = Uint8List(byteCount);
for (int i = 0; i < length; i++) {
if (bitSet.get(i + 1)) out[i >> 3] |= 0x80 >> i % 8;
}
if (length > 64) out[0] |= 0x80;
if (length > 128) out[8] |= 0x80;
return out;
}