package jasmin

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Source file uint63.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# 1 "uint63/uint63_63.ml"
(************************************************************************)
(*         *   The Coq Proof Assistant / The Coq Development Team       *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see CIL/LICENSE.coq file for the text of the license) *)
(************************************************************************)

type t = int

let _ = assert (Sys.word_size = 64)

let maxuint63 = Int64.of_string "0x7FFFFFFFFFFFFFFF"

let of_int i = i
[@@ocaml.inline always]

let equal (x : int) (y : int) = x = y
[@@ocaml.inline always]

let compares (x : int) (y : int) =
  Stdlib.Int.compare x y

let hash i = i
[@@ocaml.inline always]

let to_uint64 i = Int64.logand (Int64.of_int i) maxuint63

let to_string i = Int64.to_string (to_uint64 i)

let add x y = x + y
[@@ocaml.inline always]

let le (x : int) (y : int) =
  (x lxor 0x4000000000000000) <= (y lxor 0x4000000000000000)
[@@ocaml.inline always]