Sign-extend a bit-vector by n bits.
(n: int, x: BitVecRef)
| 1586 | |
| 1587 | |
| 1588 | def SignExt(n: int, x: BitVecRef) -> BitVecRef: |
| 1589 | """Sign-extend a bit-vector by n bits.""" |
| 1590 | sort = x._sort |
| 1591 | if not isinstance(sort, BitVecSortRef): |
| 1592 | raise TypeError("SignExt requires BitVecRef") |
| 1593 | new_width = sort._width + n |
| 1594 | return BitVecRef( |
| 1595 | SignExtNode(new_width, x._ast), |
| 1596 | BitVecSort(new_width), |
| 1597 | x._vars, |
| 1598 | ) |
| 1599 | |
| 1600 | |
| 1601 | def BV2Int(x: BitVecRef, is_signed: bool = False) -> ArithRef: |