toSigned method
Returns the least significant width
bits of this integer, extending the
highest retained bit to the sign. This is the same as truncating the
value to fit in width
bits using an signed 2-s complement
representation. The returned value has the same bit value in all positions
higher than width
.
If the input value fits in width
bits without truncation, the result is
the same as the input. The minimum width needed to avoid truncation of
x
is x.bitLength + 1
, i.e.
x == x.toSigned(x.bitLength + 1);
Implementation
@override
Int32 toSigned(int width) {
if (width < 1 || width > 32) throw RangeError.range(width, 1, 32);
return Int32(_i.toSigned(width));
}