| 1 |
Require Export PrimInt63. |
| 2 |
Require Import Uint63Axioms. |
| 3 |
|
| 4 |
Declare Scope sint63_scope. |
| 5 |
Delimit Scope sint63_scope with sint63. |
| 6 |
Definition printer (x : int_wrapper) : pos_neg_int63 := |
| 7 |
if (ltb (int_wrap x) 4611686018427387904)%uint63 then (* 2^62 *) |
| 8 |
Pos (int_wrap x) |
| 9 |
else |
| 10 |
Neg (add (lxor (int_wrap x) max_int) 1)%uint63. |
| 11 |
Definition parser (x : pos_neg_int63) : option int := |
| 12 |
match x with |
| 13 |
| Pos p => if (ltb p 4611686018427387904)%uint63 then Some p else None |
| 14 |
| Neg n => if (leb n 4611686018427387904)%uint63 |
| 15 |
then Some (lxor (sub n 1) max_int)%uint63 else None |
| 16 |
end. |
| 17 |
Number Notation int parser printer : sint63_scope. |