@@ -218,32 +218,33 @@ let rec caml_compare (a : Obj.t) (b : Obj.t) : int =
218
218
let len_a = Obj. size a in
219
219
let len_b = Obj. size b in
220
220
if len_a = len_b then
221
- if O. isArray(a)
222
- then aux_same_length a b 0 len_a
221
+ if O. isArray a
222
+ then aux_same_length ( Obj. magic a : Obj.t array ) ( Obj. magic b : Obj.t array ) 0 len_a
223
223
else if [% raw{| a instanceof Date && b instanceof Date | }] then
224
224
[% raw{| a - b| }]
225
225
else aux_obj_compare a b
226
226
else if len_a < len_b then
227
- aux_length_a_short a b 0 len_a
227
+ (* at least one is not zero, so it is an array block*)
228
+ aux_length_a_short (Obj. magic a : Obj.t array ) (Obj. magic b : Obj.t array ) 0 len_a
228
229
else
229
- aux_length_b_short a b 0 len_b
230
- and aux_same_length (a : Obj.t ) (b : Obj.t ) i same_length =
230
+ aux_length_b_short ( Obj. magic a : Obj.t array ) ( Obj. magic b : Obj.t array ) 0 len_b
231
+ and aux_same_length (a : Obj.t array ) (b : Obj.t array ) i same_length =
231
232
if i = same_length then
232
233
0
233
234
else
234
- let res = caml_compare (Obj. field a i) (Obj. field b i) in
235
+ let res = caml_compare (Caml_array_extern. unsafe_get a i) (Caml_array_extern. unsafe_get b i) in
235
236
if res <> 0 then res
236
237
else aux_same_length a b (i + 1 ) same_length
237
- and aux_length_a_short (a : Obj.t ) (b : Obj.t ) i short_length =
238
+ and aux_length_a_short (a : Obj.t array ) (b : Obj.t array ) i short_length =
238
239
if i = short_length then - 1
239
240
else
240
- let res = caml_compare (Obj. field a i) (Obj. field b i) in
241
+ let res = caml_compare (Caml_array_extern. unsafe_get a i) (Caml_array_extern. unsafe_get b i) in
241
242
if res <> 0 then res
242
243
else aux_length_a_short a b (i+ 1 ) short_length
243
- and aux_length_b_short (a : Obj.t ) (b : Obj.t ) i short_length =
244
+ and aux_length_b_short (a : Obj.t array ) (b : Obj.t array ) i short_length =
244
245
if i = short_length then 1
245
246
else
246
- let res = caml_compare (Obj. field a i) (Obj. field b i) in
247
+ let res = caml_compare (Caml_array_extern. unsafe_get a i) (Caml_array_extern. unsafe_get b i) in
247
248
if res <> 0 then res
248
249
else aux_length_b_short a b (i+ 1 ) short_length
249
250
and aux_obj_compare (a : Obj.t ) (b : Obj.t ) =
0 commit comments