Zero-extend a bit-vector by n bits.
(n: int, x: BitVecRef)
| 1573 | |
| 1574 | |
| 1575 | def ZeroExt(n: int, x: BitVecRef) -> BitVecRef: |
| 1576 | """Zero-extend a bit-vector by n bits.""" |
| 1577 | sort = x._sort |
| 1578 | if not isinstance(sort, BitVecSortRef): |
| 1579 | raise TypeError("ZeroExt requires BitVecRef") |
| 1580 | new_width = sort._width + n |
| 1581 | return BitVecRef( |
| 1582 | ZeroExtNode(new_width, x._ast), |
| 1583 | BitVecSort(new_width), |
| 1584 | x._vars, |
| 1585 | ) |
| 1586 | |
| 1587 | |
| 1588 | def SignExt(n: int, x: BitVecRef) -> BitVecRef: |