Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WASM] Better double (F64) support in MonoPlatform.ts #65959

Closed
1 task done
GeroL opened this issue Feb 26, 2022 · 1 comment · Fixed by #66304
Closed
1 task done

[WASM] Better double (F64) support in MonoPlatform.ts #65959

GeroL opened this issue Feb 26, 2022 · 1 comment · Fixed by #66304
Assignees
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono

Comments

@GeroL
Copy link

GeroL commented Feb 26, 2022

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am sending many double arrays per Unmarshalled invokes to my JS functions
I saw the Blazor.platform.toUint8Array function but it seems that this is the only helper function so far

Describe the solution you'd like

It could be new APIs like toFloat(32/64)Array like here
Also some helper functions could be implemented like the ones for float (F32)

Additional context

The types for F64 support are implemented here https:/dotnet/aspnetcore/blob/main/src/Components/Web.JS/@types/dotnet/dotnet.d.ts

I have now a function in javascript like this:

function toFloat64Array(array){
    const dataPtr = Blazor.platform.getArrayDataPointer(array);
    const length = Blazor.platform.getValueI32(dataPtr);
    const f64Array = new Float64Array(length);
    f64Array.set(Module.HEAPF64.subarray(dataPtr + 4, dataPtr + 4 + length));
    return f64Array;
}

I wasn't able to test it due to lack of time.

@pranavkm pranavkm transferred this issue from dotnet/aspnetcore Feb 28, 2022
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 28, 2022
@lewing lewing removed the untriaged New issue has not been triaged by the area owner label Feb 28, 2022
@jeffhandley jeffhandley added arch-wasm WebAssembly architecture and removed area-blazor labels Mar 3, 2022
@ghost
Copy link

ghost commented Mar 3, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am sending many double arrays per Unmarshalled invokes to my JS functions
I saw the Blazor.platform.toUint8Array function but it seems that this is the only helper function so far

Describe the solution you'd like

It could be new APIs like toFloat(32/64)Array like here
Also some helper functions could be implemented like the ones for float (F32)

Additional context

The types for F64 support are implemented here https:/dotnet/aspnetcore/blob/main/src/Components/Web.JS/@types/dotnet/dotnet.d.ts

I have now a function in javascript like this:

function toFloat64Array(array){
    const dataPtr = Blazor.platform.getArrayDataPointer(array);
    const length = Blazor.platform.getValueI32(dataPtr);
    const f64Array = new Float64Array(length);
    f64Array.set(Module.HEAPF64.subarray(dataPtr + 4, dataPtr + 4 + length));
    return f64Array;
}

I wasn't able to test it due to lack of time.

Author: GeroL
Assignees: pavelsavara
Labels:

arch-wasm, area-VM-meta-mono

Milestone: -

@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 6, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jul 10, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Aug 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-VM-meta-mono
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants