(* *********************************************************************)
(*                                                                     *)
(*              The Compcert verified compiler                         *)
(*                                                                     *)
(*          Xavier Leroy, INRIA Paris-Rocquencourt                     *)
(*                                                                     *)
(*  Copyright Institut National de Recherche en Informatique et en     *)
(*  Automatique.  All rights reserved.  This file is distributed       *)
(*  under the terms of the GNU General Public License as published by  *)
(*  the Free Software Foundation, either version 2 of the License, or  *)
(*  (at your option) any later version.  This file is also distributed *)
(*  under the terms of the INRIA Non-Commercial License Agreement.     *)
(*                                                                     *)
(* *********************************************************************)
(** Formalizations of machine integers modulo $2^N$ #2<sup>N</sup>#. *)
Require Archi.
(** * Comparisons *)
Inductive comparison : Type :=
| Ceq : comparison               (**r same *)
| Cne : comparison               (**r different *)
| Clt : comparison               (**r less than *)
| Cle : comparison               (**r less than or equal *)
| Cgt : comparison               (**r greater than *)
| Cge : comparison.              (**r greater than or equal *)
Definition negate_comparison (c: comparison): comparison :=
match c with
| Ceq => Cne
| Cne => Ceq
| Clt => Cge
| Cle => Cgt
| Cgt => Cle
| Cge => Clt
end.
Definition swap_comparison (c: comparison): comparison :=
match c with
| Ceq => Ceq
| Cne => Cne
| Clt => Cgt
| Cle => Cge
| Cgt => Clt
| Cge => Cle
end.
(** * Parameterization by the word size, in bits. *)
Module Type WORDSIZE.
Parameter wordsize: nat.

(* Specifications: *)
Axiom wordsize_not_zero: wordsize <> 0%nat.
End WORDSIZE.
Axiom wordsize_not_zero: wordsize <> 0%nat.
End WORDSIZE.