firstOne method

int? firstOne()

Compute the first One find operation on LogicValue, returning its position

Implementation

int? firstOne() {
  if (!isValid) {
    return null;
  }
  var shiftedValue = this;
  var result = 0;
  while (shiftedValue[0] != LogicValue.one) {
    result++;
    if (result == width) {
      return null;
    }
    shiftedValue >>>= 1;
  }
  return result;
}