Skip to content

Commit cebfbfd

Browse files
committed
Accept native Big(U)int64WasmArrays in the C++ code.
For some historical reason, there was no HEAP64 in older versions of Emscripten, so we expected these arrays to be converted to Float64Arrays. This is no longer an issue so we just accept Big64Arrays directly.
1 parent 301bc44 commit cebfbfd

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/hdf5_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -926,9 +926,9 @@ void write_numeric_hdf5_base(Handle_& handle, const std::string& type, std::uint
926926
} else if (type == "Int32WasmArray") {
927927
Reader_::write(handle, reinterpret_cast<const std::int32_t*>(data), H5::PredType::NATIVE_INT32);
928928
} else if (type == "Uint64WasmArray") {
929-
Reader_::write(handle, reinterpret_cast<const double*>(data), H5::PredType::NATIVE_UINT64);
929+
Reader_::write(handle, reinterpret_cast<const std::uint64_t*>(data), H5::PredType::NATIVE_UINT64);
930930
} else if (type == "Int64WasmArray") {
931-
Reader_::write(handle, reinterpret_cast<const double*>(data), H5::PredType::NATIVE_INT64);
931+
Reader_::write(handle, reinterpret_cast<const std::int64_t*>(data), H5::PredType::NATIVE_INT64);
932932
} else if (type == "Float32WasmArray") {
933933
Reader_::write(handle, reinterpret_cast<const float*>(data), H5::PredType::NATIVE_FLOAT);
934934
} else if (type == "Float64WasmArray") {

src/initialize_from_arrays.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ tatami::SomeNumericArray<Type_> create_SomeNumericArray(std::uintptr_t ptr, std:
2828
} else if (type == "Uint32Array") {
2929
t = tatami::SomeNumericType::U32;
3030
} else if (type == "BigInt64Array") {
31-
t = tatami::SomeNumericType::F64; // Aliasing these for the time being, as there is no BigInt support in the Wasm heap.
31+
t = tatami::SomeNumericType::I64;
3232
} else if (type == "BigUint64Array") {
33-
t = tatami::SomeNumericType::F64; // See above.
33+
t = tatami::SomeNumericType::U64;
3434
} else if (type == "Float32Array") {
3535
t = tatami::SomeNumericType::F32;
3636
} else if (type == "Float64Array") {

0 commit comments

Comments
 (0)