Replies: 1 comment 4 replies
-
I would imagine this is by design - a default behaviour of explicitly copying fields in Update: As you can see here, the creation is explicit: copyOfStruct@15 = new @_.Dimension2D(Vector2.Zero, 0f, 0f);
copyOfStruct@15-1 = @_.copyOfStruct@15;
newVec@15 = new @_.Dimension2D(Vector2.Multiply(new Vector2(2f), new Vector2(5f)), copyOfStruct@15-1.Width@, copyOfStruct@15-1.Height@); |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
For example
The point of explicit layout is you can change the memory by changing width / height, or the opposite way by using System.Numerics.Vector2 methods to change the memory
However I noticed that, while it's already hard to create a record with only memory is set
If I were to do :
Where
AnotherMemory
is not zero and so is value, the result is zero for some reasonBut if I were to do
It gives me a feeling that either I can't have record struct with explicit layout in F# like I can in C#, or there is a bug with it
I wanted to do this because if I store my value in Vector struct they get hardware accelerated sometimes. Performance is important to F# aye, so I am hoping I can write these kinds of codes
Beta Was this translation helpful? Give feedback.
All reactions