From ecb2545918dfaeab2bb3d48e48476fa6d5224813 Mon Sep 17 00:00:00 2001 From: Hugo Heuzard Date: Thu, 26 Sep 2024 20:21:06 +0200 Subject: [PATCH] Compiler: nativeInt is always 32bit --- compiler/lib/code.ml | 12 ++++++------ compiler/lib/code.mli | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/lib/code.ml b/compiler/lib/code.ml index 6b4c2d09f3..5b52f0015a 100644 --- a/compiler/lib/code.ml +++ b/compiler/lib/code.ml @@ -327,10 +327,10 @@ type constant = | NativeString of Native_string.t | Float of float | Float_array of float array - | Int of int32 - | Int32 of int32 - | Int64 of int64 - | NativeInt of nativeint + | Int of Int32.t + | Int32 of Int32.t + | Int64 of Int64.t + | NativeInt of Int32.t (* Native int are 32bit on all known backend *) | Tuple of int * constant array * array_or_not module Constant = struct @@ -354,7 +354,7 @@ module Constant = struct !same | Int a, Int b | Int32 a, Int32 b -> Some (Int32.equal a b) | Int64 a, Int64 b -> Some (Int64.equal a b) - | NativeInt a, NativeInt b -> Some (Nativeint.equal a b) + | NativeInt a, NativeInt b -> Some (Int32.equal a b) | Float_array a, Float_array b -> Some (Array.equal Float.ieee_equal a b) | Float a, Float b -> Some (Float.ieee_equal a b) | String _, NativeString _ | NativeString _, String _ -> None @@ -500,7 +500,7 @@ module Print = struct | Int i -> Format.fprintf f "%ld" i | Int32 i -> Format.fprintf f "%ldl" i | Int64 i -> Format.fprintf f "%LdL" i - | NativeInt i -> Format.fprintf f "%ndn" i + | NativeInt i -> Format.fprintf f "%ldn" i | Tuple (tag, a, _) -> ( Format.fprintf f "<%d>" tag; match Array.length a with diff --git a/compiler/lib/code.mli b/compiler/lib/code.mli index 748856c28f..639b470312 100644 --- a/compiler/lib/code.mli +++ b/compiler/lib/code.mli @@ -173,10 +173,10 @@ type constant = | NativeString of Native_string.t | Float of float | Float_array of float array - | Int of int32 - | Int32 of int32 (** Only produced when compiling to WebAssembly. *) - | Int64 of int64 - | NativeInt of nativeint (** Only produced when compiling to WebAssembly. *) + | Int of Int32.t + | Int32 of Int32.t (** Only produced when compiling to WebAssembly. *) + | Int64 of Int64.t + | NativeInt of Int32.t (** Only produced when compiling to WebAssembly. *) | Tuple of int * constant array * array_or_not module Constant : sig