Skip to content

Commit

Permalink
Runtime: fix for num 1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Dec 18, 2023
1 parent 67f3982 commit a2d3b4f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion runtime/nat.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ function initialize_nat() {
//Provides: MlNat
function MlNat(x){
this.data = new Int32Array(x);
// For num < 1.5
// length_nat isn't external, so we have to make the Obj.size
// work out right. The +2 to array length seems to work.
// work out right.
// We add +2 to the array length:
// - +1 for the tag
// - +1 for the custom_ops slot
this.length = this.data.length + 2
}

Expand All @@ -30,6 +34,10 @@ function caml_hash_nat(x) {
return h;
}

//Provides: length_nat
function length_nat(x) {
return x.data.length;
}

//Provides: nat_of_array
//Requires: MlNat
Expand Down

0 comments on commit a2d3b4f

Please sign in to comment.