src/blockchain/ProofPath.js
function setBit (buffer, pos, bit) {
  const byte = Math.floor(pos / 8)
  const bitPos = pos % 8

  if (bit === 0) {
    const mask = 255 - (1 << bitPos)
    buffer[byte] &= mask
  } else {
    const mask = (1 << bitPos)
    buffer[byte] |= mask
  }
}
function setBit (buffer, pos, bit) {
  const byte = Math.floor(pos / 8)
  const bitPos = pos % 8

  if (bit === 0) {
    const mask = 255 - (1 << bitPos)
    buffer[byte] &= mask
  } else {
    const mask = (1 << bitPos)
    buffer[byte] |= mask
  }
}
function setBit ( buffer , pos , bit ) { const byte = Math . floor ( pos / 8 ) const bitPos = pos % 8 if ( bit === 0 ) { const mask = 255 - ( 1 << bitPos ) buffer [ byte ] &= mask } else { const mask = ( 1 << bitPos ) buffer [ byte ] |= mask } }
Sets a specified bit in the byte buffer.

@param {Uint8Array} buffer
@param {number} pos 0-based position in the buffer to set
@param {0 | 1} bit
Sets a specified bit in the byte buffer .