File tree Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Expand file tree Collapse file tree 2 files changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -220,8 +220,11 @@ JS::Scalar::Type BufferType::_getPyBufferType(Py_buffer *bufView) {
220
220
return JS::Scalar::Float32;
221
221
} else if (typeCode == ' d' ) {
222
222
return JS::Scalar::Float64;
223
+ } else if (typeCode == ' e' ) {
224
+ return JS::Scalar::Float16;
223
225
}
224
226
227
+
225
228
// integer types
226
229
// We can't rely on the type codes alone since the typecodes are mapped to C types and would have different sizes on different architectures
227
230
// see https://docs.python.org/3.9/library/array.html#module-array
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ def assert_js_to_py_memoryview(buf: memoryview):
50
50
assert pm .eval ("(arr)=>arr instanceof Int16Array" )(numpy .array ([1 ], dtype = numpy .int16 ))
51
51
assert pm .eval ("(arr)=>arr instanceof Int32Array" )(numpy .array ([1 ], dtype = numpy .int32 ))
52
52
assert pm .eval ("(arr)=>arr instanceof BigInt64Array" )(numpy .array ([1 ], dtype = numpy .int64 ))
53
+ assert pm .eval ("(arr)=>arr instanceof Float16Array" )(numpy .array ([1 ], dtype = numpy .float16 ))
53
54
assert pm .eval ("(arr)=>arr instanceof Float32Array" )(numpy .array ([1 ], dtype = numpy .float32 ))
54
55
assert pm .eval ("(arr)=>arr instanceof Float64Array" )(numpy .array ([1 ], dtype = numpy .float64 ))
55
56
assert pm .eval ("new Uint8Array([1])" ).format == "B"
@@ -60,6 +61,7 @@ def assert_js_to_py_memoryview(buf: memoryview):
60
61
assert pm .eval ("new Int16Array([1])" ).format == "h"
61
62
assert pm .eval ("new Int32Array([1])" ).format == "i"
62
63
assert pm .eval ("new BigInt64Array([1n])" ).format == "q"
64
+ assert pm .eval ("new Float16Array([1])" ).format == "e"
63
65
assert pm .eval ("new Float32Array([1])" ).format == "f"
64
66
assert pm .eval ("new Float64Array([1])" ).format == "d"
65
67
You can’t perform that action at this time.
0 commit comments