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
519374
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
  }
}
108879
function(pos){
		var pos0 = this.cursor.getaddr();
		this.cursor.setaddr(pos);
		pos0.draw();
		pos.draw();
	}
1089382
function _makeBitReversal() {
    var i = 0,
        j = 0,
        k = 0;
    _bitrev[0] = 0;
    while(++i < _n) {
      k = _n >> 1;
      while(k <= j) {
        j -= k;
        k >>= 1;
      }
      j += k;
      _bitrev[i] = j;
    }
  }
656397
public void writeBinary(final PacketOutputStream pos) throws IOException {
    pos.write((byte) (fractionalSeconds ? 11 : 7));//length
    pos.writeShort((short) tz.getYear());
    pos.write((byte) ((tz.getMonth().getValue()) & 0xff));
    pos.write((byte) (tz.getDayOfMonth() & 0xff));
    pos.write((byte) tz.getHour());
    pos.write((byte) tz.getMinute());
    pos.write((byte) tz.getSecond());
    if (fractionalSeconds) {
      pos.writeInt(tz.getNano() / 1000);
    }
  }
1058308
private void setBitsImpl(int position, long value, int length) {
		int i = position >> ADDRESS_BITS;
		int s = position & ADDRESS_MASK;
		long m = length == ADDRESS_SIZE ? -1L : (1L << length) - 1L;
		long v = value & m;
		performAdjSet(length, i, s, m, v);
	}
647153
public void setPos(Object p) {
        Object[] a = (Object[]) p;
        buf = (char[]) a[0];
        int[] v = (int[]) a[1];
        pos.setIndex(v[0]);
        bufPos = v[1];
    }
137372
public static int setByte(int map, byte value, int pos) {

        int intValue = (value & 0xff) << (24 - pos);
        int mask     = 0xff000000 >>> pos;

        mask = ~mask;
        map  &= mask;

        return (map | intValue);
    }
775955
function setPosition(node, msg, blind) {
    blind.blindPosition = msg.payload.blindPosition;
    blind.blindPositionExpiry = calcBlindPositionExpiry(msg.payload.expiryperiod ? msg.payload.expiryperiod : blind.expiryperiod);
    blind.blindPositionReasonCode = "01";
    blind.blindPositionReasonDesc = RED._("blindcontroller.positionReason.01");
    msg.payload = blind;
    msg.topic = "blind";
    node.send(msg);
  }
918849
function setBytes(node, bytes) {
    if (typeof bytes === 'string') {
        bytes = ByteUtils.base64ToBytes(bytes);
    }
    setText(node, bytes ? ByteUtils.bytesToBase64(ByteUtils.arrayToBuffer(bytes)) : undefined);
}
1168642
public void seek(long pos) throws IOException
    {
        long inSegmentPos = pos - segmentOffset;
        if (inSegmentPos < 0 || inSegmentPos > buffer.capacity())
            throw new IOException(String.format("Seek position %d is not within mmap segment (seg offs: %d, length: %d)", pos, segmentOffset, buffer.capacity()));

        seekInternal((int) inSegmentPos);
    }
871489
public void emit(byte[] buffer) {
        	buffer[myOffset+0] = (byte) ((value >>> 24) & 0xff);
        	buffer[myOffset+1] = (byte) ((value >>> 16) & 0xff);
            buffer[myOffset+2] = (byte) ((value >>> 8) & 0xff);
            buffer[myOffset+3] = (byte) ((value >>> 0) & 0xff);
        }
708511
function (buffer, start, length) {
  /*jshint bitwise:false*/

  var isNested = buffer instanceof ByteBuffer;

  this.buffer = isNested ? buffer.buffer : buffer;
  this.start = (start || 0) + (isNested ? buffer.start : 0);
  this.length = length || (this.buffer.length - this.start);
  this.offset = 0;

}
127162
public void writeBinary(PacketOutputStream pos) throws IOException {
    String value = bigDecimal.toPlainString();
    pos.writeFieldLength(value.length());
    pos.write(value);
  }
325945
public int setBytes(final long pos, byte[] bytes) throws SQLException {
        if (bytes == null) {
            throw new IllegalArgumentException("No byte to be set");
        } // end of if

        return setBytes(pos, bytes, 0, bytes.length);
    }
1353546
public char setIndex(int pos) 
  { 
    if (pos < 0) {
      _pos = 0;
      return DONE;
    }
    else if (_length <= pos) {
      _pos = _length;
      return DONE;
    }
    else {
      _pos = pos; 
      return _string.charAt(pos);
    }
  }
458537
function(x) {
  var len, i;
  if (x instanceof Buffer) { // Copy
    this.buf = new Buffer(x.length);
    x.copy(this.buf);
  } else if (x instanceof BitBuffer) {
    this.buf = new Buffer(x.buf.length);
    x.buf.copy(this.buf);
  } else { // Size
    if (typeof(x) === 'number') { // Size
      len = x;
    } else {
      len = 128;
    }
    this.buf = new Buffer(len / 8);
    // Zero the buffer before use.
    len = this.buf.length;
    for (i = 0; i < len; i += 1) {
      this.buf[i] = 0;
    }
  }
}
976514
def _set(self, pos):
        """"""
        assert 0 <= pos < self.len
        self._datastore.setbit(pos)