majority method
Compute the unary majority on LogicValue
Implementation
bool majority() {
if (!isValid) {
return false;
}
final zero = LogicValue.filled(width, LogicValue.zero);
var shiftedValue = this;
var result = 0;
while (shiftedValue != zero) {
result += (shiftedValue[0] & LogicValue.one == LogicValue.one) ? 1 : 0;
shiftedValue >>>= 1;
}
return result > (width ~/ 2);
}