setBit method

void setBit (
  1. int pos,
  2. bool value
)

sets the bit on position to value

'true' ... 1 'false' ... 0

Implementation

void setBit(int pos, bool value) {
  if (value) {
    //set bit to 1
    _source = _source | (1 << pos);
  } else {
    //set bit to 0
    _source = _source & ~(1 << pos);
  }
}