diff --git a/interpreter/exec/simd.ml b/interpreter/exec/simd.ml index b61b44794..5a2b83de3 100644 --- a/interpreter/exec/simd.ml +++ b/interpreter/exec/simd.ml @@ -20,8 +20,6 @@ sig val to_string : t -> string val bytewidth : int val of_strings : shape -> string list -> t - val of_bits : string -> t - val to_bits : t -> string end module type S = @@ -35,14 +33,14 @@ sig val of_strings : shape -> string list -> t end -module Make (Rep : RepType) : S with type bits = string = +module Make (Rep : RepType) : S with type bits = Rep.t = struct type t = Rep.t - type bits = string + type bits = Rep.t let default = Rep.make Rep.bytewidth (chr 0) let to_string = Rep.to_string (* FIXME very very wrong *) - let of_bits = Rep.of_bits - let to_bits = Rep.to_bits + let of_bits x = x + let to_bits x = x let of_strings = Rep.of_strings end diff --git a/interpreter/exec/v128.ml b/interpreter/exec/v128.ml index 22a4bc121..33d6bd775 100644 --- a/interpreter/exec/v128.ml +++ b/interpreter/exec/v128.ml @@ -1,9 +1,8 @@ include Simd.Make (struct - include Bytes + include String let bytewidth = 16 - let of_bits = Bytes.of_string - let to_bits = Bytes.to_string + let to_string s = s let of_strings shape ss = if List.length ss <> Simd.lanes shape then raise (Invalid_argument "wrong length"); @@ -28,5 +27,5 @@ include Simd.Make List.iteri (fun i s -> set_int32_le b (i * 4) (F32.to_bits (F32.of_string s))) ss | Simd.F64x2 -> List.iteri (fun i s -> set_int64_le b (i * 8) (F64.to_bits (F64.of_string s))) ss); - b + Bytes.to_string b end)