This repository was archived by the owner on Dec 22, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Expand file tree Collapse file tree 3 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ let encode m =
6262 let vs32 i = vs64 (Int64. of_int32 i)
6363 let f32 x = u32 (F32. to_bits x)
6464 let f64 x = u64 (F64. to_bits x)
65+ let v128 v = String. iter (put s) (V128. to_bits v)
6566
6667 let len i =
6768 if Int32. to_int (Int32. of_int i) <> i then
@@ -225,7 +226,7 @@ let encode m =
225226 | Const {it = I64 c ; _} -> op 0x42 ; vs64 c
226227 | Const {it = F32 c ; _} -> op 0x43 ; f32 c
227228 | Const {it = F64 c ; _} -> op 0x44 ; f64 c
228- | Const {it = V128 c ; _} -> simd_op 0x02 ; Bytes. iter (put s) ( V128. to_bits c)
229+ | Const {it = V128 c ; _} -> simd_op 0x02 ; v128 c
229230
230231 | Test (I32 I32Op. Eqz) -> op 0x45
231232 | Test (I64 I64Op. Eqz) -> op 0x50
Original file line number Diff line number Diff line change 2020 val to_string : t -> string
2121 val bytewidth : int
2222 val of_strings : shape -> string list -> t
23+ val of_bits : string -> t
24+ val to_bits : t -> string
2325end
2426
2527module type S =
3335 val of_strings : shape -> string list -> t
3436end
3537
36- module Make (Rep : RepType ) : S with type bits = Rep. t =
38+ module Make (Rep : RepType ) : S with type bits = string =
3739struct
3840 type t = Rep .t
39- type bits = Rep .t
41+ type bits = string
4042
4143 let default = Rep. make Rep. bytewidth (chr 0 )
4244 let to_string = Rep. to_string (* FIXME very very wrong *)
43- let to_bits x = x
44- let of_bits x = x
45+ let of_bits = Rep. of_bits
46+ let to_bits = Rep. to_bits
4547 let of_strings = Rep. of_strings
4648end
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ include Simd.Make
22 (struct
33 include Bytes
44 let bytewidth = 16
5+ let of_bits = Bytes. of_string
6+ let to_bits = Bytes. to_string
57
68 let of_strings shape ss =
79 if List. length ss <> Simd. lanes shape then raise (Invalid_argument " wrong length" );
You can’t perform that action at this time.
0 commit comments