1 (* 63 bit signed integer type.
2 (C) Copyright 2008 Richard W.M. Jones, Red Hat Inc.
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version,
8 with the OCaml linking exception described in ../COPYING.LIB.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 (* This is the 64 bit implementation so for efficiency we used the
21 * unboxed int type directly.
25 module Operators = struct
28 external ( +^ ) : int -> int -> int = "%addint"
29 external ( -^ ) : int -> int -> int = "%subint"
30 external ( *^ ) : int -> int -> int = "%mulint"
31 external ( /^ ) : int -> int -> int = "%divint"
32 external ( %^ ) : int -> int -> int = "%modint"
33 external ( <^< ) : int -> int -> int = "%lslint"
34 external ( >^> ) : int -> int -> int = "%lsrint"
35 external ( &^ ) : int -> int -> int = "%andint"
36 external ( |^ ) : int -> int -> int = "%orint"
37 external ( ^^ ) : int -> int -> int = "%xorint"
38 external ( ~^ ) : int -> int = "%identity"
39 external ( ~^~ ) : int -> int = "%negint"
46 external neg : int -> int = "%negint"
48 external add : int -> int -> int = "%addint"
49 external sub : int -> int -> int = "%subint"
50 external mul : int -> int -> int = "%mulint"
51 external div : int -> int -> int = "%divint"
52 external rem : int -> int -> int = "%modint"
54 external succ : int -> int = "%succint"
55 external pred : int -> int = "%predint"
62 external logand : int -> int -> int = "%andint"
63 external logor : int -> int -> int = "%orint"
64 external logxor : int -> int -> int = "%xorint"
67 external shift_left : int -> int -> int = "%lslint"
68 external shift_right : int -> int -> int = "%asrint"
69 external shift_right_logical : int -> int -> int = "%lsrint"
71 external of_int : int -> int = "%identity"
72 external to_int : int -> int = "%identity"
73 external of_float : float -> int = "%intoffloat"
74 external to_float : int -> float = "%floatofint"
75 external of_int32 : int32 -> int = "%int32_to_int"
76 external to_int32 : int -> int32 = "%int32_of_int"
77 external of_int64 : int64 -> int = "%int64_to_int"
78 external to_int64 : int -> int64 = "%int64_of_int"
79 external of_nativeint : nativeint -> int = "%nativeint_to_int"
80 external to_nativeint : int -> nativeint = "%nativeint_of_int"
82 external of_string : string -> int = "caml_int_of_string"
83 let to_string = string_of_int
85 (*external compare : int -> int -> int = "%compare"*)
86 (* I think it should be faster to use a specialized compare: *)
87 let compare : int -> int -> int = compare