Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-bridge/blob/main/tests/native/g1/reference.py # omega-bridge Omega-first language interoperability: checked conversion backends and native language bindings Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-bridge / tests / native / g1 / reference.py` 17 lines ยท 799 bytes Raw Blame History 1 # Python bigint reference for the G1 sample calc(i0, i1) = (i0 + i1) * (i0 - i1) modulo 2^64. 2 # "vectors" prints the boundary vectors, one "i0 i1" line each: every ordered pair of the values below 3 # (0, 1, 2^63 and 2^64-1 among them). "expect" reads such lines and prints "i0 i1 0 result", the line 4 # each caller must print for a status-0 call. Arbitrary-precision ints, reduced once at the end. 5 import sys 6 M = 2**64 7 VALUES = [0, 1, 2, 2**32, 2**63 - 1, 2**63, 2**63 + 1, 2**64 - 2, 2**64 - 1] 8 if sys.argv[1:] == ["vectors"]: 9 for a in VALUES: 10 for b in VALUES: 11 print(a, b) 12 elif sys.argv[1:] == ["expect"]: 13 for line in sys.stdin: 14 a, b = map(int, line.split()) 15 print(a, b, 0, ((a + b) * (a - b)) % M) 16 else: 17 sys.exit("usage: reference.py vectors|expect")