xpile 0.1.616

Polyglot transpile workbench (Python/C/C++/Rust/Ruchy/Lean ↔ Rust/Ruchy/PTX/WGSL/SPIR-V) with provable contracts at every layer.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def sh(x: int, n: int) -> int:
    # `x << n` must PANIC on i64 value overflow (C-PY-INT-ARITH promises a
    # panic until bigint promotion lands) — `checked_shl` alone only guards the
    # shift *amount*, so `1 << 63` previously wrapped to i64::MIN silently.
    return x << n


def small() -> int:
    return 1 << 10


def fits_exactly() -> int:
    # -2 << 62 == i64::MIN — fits exactly, must NOT panic.
    return -2 << 62