UNPKG

asn1-ts

Version:

ASN.1 encoding and decoding, including BER, CER, and DER.

10 lines (9 loc) 276 B
export default function setBitInBase256(to, bitIndex, value) { const byteIndex = (to.length - (Math.floor(bitIndex / 8) + 1)); if (value) { to[byteIndex] |= (0x01 << (bitIndex % 8)); } else { to[byteIndex] &= ~(0x01 << (bitIndex % 8)); } }