@reversed_processor<EOL><INDENT>def sign_extend(self, new_length):<DEDENT>
msb = self.extract(self.bits - <NUM_LIT:1>, self.bits - <NUM_LIT:1>).eval(<NUM_LIT:2>)<EOL>if msb == [ <NUM_LIT:0> ]:<EOL><INDENT>return self.zero_extend(new_length)<EOL><DEDENT>if msb == [ <NUM_LIT:1> ]:<EOL><INDENT>si = self.copy()<EOL>si._bits = new_length<EOL>mask = (<NUM_LIT:2> ** new_length - <NUM_LIT:1>) - (<NUM_LIT:2> ** self.bits - <NUM_LIT:1>)<EOL>si._lower_bound |= mask<EOL>si._upper_bound |= mask<EOL><DEDENT>else:<EOL><INDENT>numbers = self._nsplit()<EOL>all_resulting_intervals = list()<EOL>assert len(numbers) > <NUM_LIT:0><EOL>for n in numbers:<EOL><INDENT>a, b = n.lower_bound, n.upper_bound<EOL>mask_a = <NUM_LIT:0><EOL>mask_b = <NUM_LIT:0><EOL>mask_n = ((<NUM_LIT:1> << (new_length - n.bits)) - <NUM_LIT:1>) << n.bits<EOL>if StridedInterval._get_msb(a, n.bits) == <NUM_LIT:1>:<EOL><INDENT>mask_a = mask_n<EOL><DEDENT>if StridedInterval._get_msb(b, n.bits) == <NUM_LIT:1>:<EOL><INDENT>mask_b = mask_n<EOL><DEDENT>si_ = StridedInterval(bits=new_length, stride=n.stride, lower_bound=a | mask_a, upper_bound=b | mask_b)<EOL>all_resulting_intervals.append(si_)<EOL><DEDENT>si = StridedInterval.least_upper_bound(*all_resulting_intervals).normalize()<EOL><DEDENT>si.uninitialized = self.uninitialized<EOL>return si<EOL>
Unary operation: SignExtend

:param new_length: New length after sign-extension
:return: A new StridedInterval