From e435c8bd9f6619c42b82e53e5d1caa929b5d4ebf Mon Sep 17 00:00:00 2001 From: Oscar Spencer Date: Sun, 16 Jan 2022 11:33:41 -0500 Subject: [PATCH] fix: Make features work in 32-bit mode (#123) --- js/module.ml | 4 +++- src/module.ml | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/module.ml b/js/module.ml index 4fad03c3..70416e3a 100644 --- a/js/module.ml +++ b/js/module.ml @@ -74,7 +74,9 @@ let get_features wasm_mod = feature :: split_features (feature lsr 1) | feature -> split_features (feature lsr 1) in - split_features 0x80000000 + (* Support 32-bit OCaml where integers are 31 bits *) + (* This supports up to 31 Binaryen features *) + split_features 0x40000000 let set_features wasm_mod features = meth_call wasm_mod "setFeatures" diff --git a/src/module.ml b/src/module.ml index 2febd4a7..3d7316a6 100644 --- a/src/module.ml +++ b/src/module.ml @@ -85,7 +85,9 @@ let get_features wasm_mod = feature :: split_features (feature lsr 1) | feature -> split_features (feature lsr 1) in - split_features 0x80000000 + (* Support 32-bit OCaml where integers are 31 bits *) + (* This supports up to 31 Binaryen features *) + split_features 0x40000000 external set_features : t -> int -> unit = "caml_binaryen_module_set_features"