@@ -125,40 +125,12 @@ let caml_update_dummy x y =
125
125
let y_tag = Obj. tag y in
126
126
if y_tag <> 0 then
127
127
Obj. set_tag x y_tag
128
-
129
- type 'a selector = 'a -> 'a -> 'a
130
128
(* Bs_obj.set_length x (Bs_obj.length y) *)
131
129
(* [set_length] seems redundant here given that it is initialized as an array
132
130
*)
133
- let caml_int_compare (x : int ) (y : int ) : int =
134
- if x < y then - 1 else if x = y then 0 else 1
135
-
136
- (* could be replaced by [Math.min], but it seems those built-ins are slower *)
137
- let caml_int_min (x : int ) (y : int ) : int =
138
- if x < y then x else y
139
- let caml_float_min (x : float ) y =
140
- if x < y then x else y
141
- let caml_string_min (x : string ) y =
142
- if x < y then x else y
143
- let caml_nativeint_min (x : nativeint ) y =
144
- if x < y then x else y
145
- let caml_int32_min (x : int32 ) y =
146
- if x < y then x else y
147
-
148
- let caml_int_max (x : int ) (y : int ) : int =
149
- if x > y then x else y
150
- let caml_float_max (x : float ) y =
151
- if x > y then x else y
152
- let caml_string_max (x : string ) y =
153
- if x > y then x else y
154
- let caml_nativeint_max (x : nativeint ) y =
155
- if x > y then x else y
156
- let caml_int32_max (x : int32 ) y =
157
- if x > y then x else y
158
-
159
-
160
- let caml_string_compare (x : string ) (y : string ) : int =
161
- if x < y then - 1 else if x = y then 0 else 1
131
+
132
+ type 'a selector = 'a -> 'a -> 'a
133
+
162
134
163
135
let unsafe_js_compare x y =
164
136
if x == y then 0 else
@@ -187,13 +159,13 @@ let rec caml_compare (a : Obj.t) (b : Obj.t) : int =
187
159
let a_type = Js. typeof a in
188
160
let b_type = Js. typeof b in
189
161
if a_type = " string" then
190
- caml_string_compare (Obj. magic a) (Obj. magic b )
162
+ Pervasives. compare (Obj. magic a : string ) (Obj. magic b )
191
163
else
192
164
let is_a_number = a_type = " number" in
193
165
let is_b_number = b_type = " number" in
194
166
match is_a_number , is_b_number with
195
167
| true , true ->
196
- caml_int_compare (Obj. magic a) (Obj. magic b )
168
+ Pervasives. compare (Obj. magic a : int ) (Obj. magic b : int )
197
169
| true , false -> - 1 (* Integer < Block in OCaml runtime GPR #1195 *)
198
170
| false , true -> 1
199
171
| false , false ->
@@ -218,7 +190,7 @@ let rec caml_compare (a : Obj.t) (b : Obj.t) : int =
218
190
else if tag_b = 250 then
219
191
caml_compare a (Obj. field b 0 )
220
192
else if tag_a = 248 (* object/exception *) then
221
- caml_int_compare (Obj. magic @@ Obj. field a 1 ) (Obj. magic @@ Obj. field b 1 )
193
+ Pervasives. compare (Obj. magic @@ Obj. field a 1 : int ) (Obj. magic @@ Obj. field b 1 )
222
194
else if tag_a = 251 (* abstract_tag *) then
223
195
raise (Invalid_argument " equal: abstract value" )
224
196
else if tag_a <> tag_b then
@@ -307,8 +279,6 @@ and aux_equal_length (a : Obj.t) (b : Obj.t) i same_length =
307
279
308
280
let caml_notequal a b = not (caml_equal a b)
309
281
310
- let caml_int32_compare = caml_int_compare
311
- let caml_nativeint_compare = caml_int_compare
312
282
let caml_greaterequal a b = caml_compare a b > = 0
313
283
314
284
let caml_greaterthan a b = caml_compare a b > 0
0 commit comments