signExtendFrom method Null safety

Value signExtendFrom(
  1. Value other
)

Implementation

Value signExtendFrom(Value other) {
  if (!_model.signMode.doesSignExtension) {
    return other;
  }
  BigInt internal = other.internal;
  if (BigInt.zero == internal & _model.signMask) {
    return other;
  }
  BigInt bitToSet = _model.signMask << 1;
  while (bitToSet <= signMask) {
    internal = internal | bitToSet;
    bitToSet <<= 1;
  }
  return Value.fromInternal(internal);
}