MCPcopy Index your code
hub / github.com/python/mypy / Extend

Class Extend

mypyc/ir/ops.py:1347–1378  ·  view source on GitHub ↗

result = extend src from src_type to dst_type Extend a value from a type with fewer bits to a type with more bits. dst_type and src_type can be native integer types, bools or tagged integers. Tagged integers should have the tag bit unset. If 'signed' is true, perform sign extensio

Source from the content-addressed store, hash-verified

1345
1346@final
1347class Extend(RegisterOp):
1348 """result = extend src from src_type to dst_type
1349
1350 Extend a value from a type with fewer bits to a type with more bits.
1351
1352 dst_type and src_type can be native integer types, bools or tagged
1353 integers. Tagged integers should have the tag bit unset.
1354
1355 If 'signed' is true, perform sign extension. Otherwise, the result will be
1356 zero extended.
1357 """
1358
1359 error_kind = ERR_NEVER
1360
1361 def __init__(self, src: Value, dst_type: RType, signed: bool, line: int = -1) -> None:
1362 super().__init__(line)
1363 self.src = src
1364 self.type = dst_type
1365 self.src_type = src.type
1366 self.signed = signed
1367
1368 def sources(self) -> list[Value]:
1369 return [self.src]
1370
1371 def set_sources(self, new: list[Value]) -> None:
1372 (self.src,) = new
1373
1374 def stolen(self) -> list[Value]:
1375 return []
1376
1377 def accept(self, visitor: OpVisitor[T]) -> T:
1378 return visitor.visit_extend(self)
1379
1380
1381@final

Callers 7

translate_i64Function · 0.90
translate_i32Function · 0.90
translate_i16Function · 0.90
coerceMethod · 0.90
test_extendMethod · 0.90

Calls

no outgoing calls

Tested by 1

test_extendMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…