Skip to content

Commit a2d3b4f

Browse files
committed
Runtime: fix for num 1.5
1 parent 67f3982 commit a2d3b4f

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

runtime/nat.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@ function initialize_nat() {
1212
//Provides: MlNat
1313
function MlNat(x){
1414
this.data = new Int32Array(x);
15+
// For num < 1.5
1516
// length_nat isn't external, so we have to make the Obj.size
16-
// work out right. The +2 to array length seems to work.
17+
// work out right.
18+
// We add +2 to the array length:
19+
// - +1 for the tag
20+
// - +1 for the custom_ops slot
1721
this.length = this.data.length + 2
1822
}
1923

@@ -30,6 +34,10 @@ function caml_hash_nat(x) {
3034
return h;
3135
}
3236

37+
//Provides: length_nat
38+
function length_nat(x) {
39+
return x.data.length;
40+
}
3341

3442
//Provides: nat_of_array
3543
//Requires: MlNat

0 commit comments

Comments
 (0)