Skip to content

Commit 84908ce

Browse files
authored
Lib: make the typed array api cleaner (#1227)
1 parent 53907dc commit 84908ce

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

lib/js_of_ocaml/typed_array.ml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
open! Import
2121
open Js
2222

23+
type uint32 = float
24+
2325
class type arrayBuffer =
2426
object
2527
method byteLength : int readonly_prop
@@ -199,9 +201,9 @@ class type dataView =
199201

200202
method getInt32_ : int -> bool t -> int meth
201203

202-
method getUint32 : int -> float meth
204+
method getUint32 : int -> uint32 meth
203205

204-
method getUint32_ : int -> bool t -> float meth
206+
method getUint32_ : int -> bool t -> uint32 meth
205207

206208
method getFloat32 : int -> float meth
207209

@@ -227,9 +229,9 @@ class type dataView =
227229

228230
method setInt32_ : int -> int -> bool t -> unit meth
229231

230-
method setUint32 : int -> float -> unit meth
232+
method setUint32 : int -> uint32 -> unit meth
231233

232-
method setUint32_ : int -> float -> bool t -> unit meth
234+
method setUint32_ : int -> uint32 -> bool t -> unit meth
233235

234236
method setFloat32 : int -> float -> unit meth
235237

lib/js_of_ocaml/typed_array.mli

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222

2323
open Js
2424

25+
type uint32 = float
26+
2527
class type arrayBuffer =
2628
object
2729
method byteLength : int readonly_prop
@@ -140,7 +142,7 @@ val int32Array_inBuffer : (arrayBuffer t -> int -> int -> int32Array t) constr
140142

141143
val uint32Array : (int -> uint32Array t) constr
142144

143-
val uint32Array_fromArray : (float js_array t -> uint32Array t) constr
145+
val uint32Array_fromArray : (uint32 js_array t -> uint32Array t) constr
144146

145147
val uint32Array_fromTypedArray : (uint32Array t -> uint32Array t) constr
146148

@@ -194,9 +196,9 @@ class type dataView =
194196

195197
method getInt32_ : int -> bool t -> int meth
196198

197-
method getUint32 : int -> float meth
199+
method getUint32 : int -> uint32 meth
198200

199-
method getUint32_ : int -> bool t -> float meth
201+
method getUint32_ : int -> bool t -> uint32 meth
200202

201203
method getFloat32 : int -> float meth
202204

@@ -222,9 +224,9 @@ class type dataView =
222224

223225
method setInt32_ : int -> int -> bool t -> unit meth
224226

225-
method setUint32 : int -> float -> unit meth
227+
method setUint32 : int -> uint32 -> unit meth
226228

227-
method setUint32_ : int -> float -> bool t -> unit meth
229+
method setUint32_ : int -> uint32 -> bool t -> unit meth
228230

229231
method setFloat32 : int -> float -> unit meth
230232

0 commit comments

Comments
 (0)