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