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

newbie's question.. use in c# / vector struct / adding int64... #8280

Open
foranie opened this issue Apr 13, 2024 · 0 comments
Open

newbie's question.. use in c# / vector struct / adding int64... #8280

foranie opened this issue Apr 13, 2024 · 0 comments

Comments

@foranie
Copy link

foranie commented Apr 13, 2024

It's been a year since I started using it...
there's still a section where I get stuck once every time I insert and subtract data.

I came because I couldn't solve various problems.

The following declaration was made to FBS.

table resWorldUserListCR
{
    result:resultcode;
    userinfo:[cUserInfo];


    testint64:int64;//add for int64 maxvalue test
}
root_type resWorldUserListCR;

Returns the result code (success/failure...) of the request and the user's list.

cUserInfo is as follows.

struct cUserInfo
{
    uuid:int64;
    cpos:Vec3;
    tpos:Vec3;
}

It contains the user's unique ID and location values.

I started make a packet.

Offset<cUserInfo>[] userOffsetAry = new Offset<cUserInfo>[keys.Count];
for(;;)
	userOffsetAry[index] = cUserInfo.CreatecUserInfo(builder, (Int64.MaxValue),2,3,4,5,6,7);//Question 1!!!!

var usersOffset = builder.CreateVectorOfTables<cUserInfo>(userOffsetAry);//Question 2!!!!!



res = resWorldUserListCR.CreateresWorldUserListCR(builder, resultcode.success, usersOffset);
builder.Finish(res.Value);



var asd = resWorldUserListCR.GetRootAsresWorldUserListCR(builder.DataBuffer); //Question 3!!!!!!!!!
                            Int64 asdasdasd = asd.Userinfo(0).Value.Uuid;

I have two questions about the above.

Q1. If you look at Question 1 and Question 3, there is a part where cUserInfo's uuid : int64 is put in and left out.

When the client receives the value sent from the server, the input value does not come out, so I wrote such a code.

The result was int64.MaxValue = 9223372036854775807 but it came out asdasdasd= -4294967292. What did it go wrong?

Q2. To make the structure offset, put the offset into the offset Array, and put the offset into the packet CreateVectorOfTables() was used.
In c++, CreateVectorOfStructure() is used in that case, but is it okay to use CreateVectorOfTables() in C#?

You will see that there is only API - C# item in the official document..

For the test, add the testint64:int64 value to the resWorldUserListCR and deliver the int64.MaxValue instead of the structure cUserInfo, the value is coming out properly.

Is it the simplest version of the problem?
Or is there a constraint rule that the structure can't contain int64?
It seems like it's supporting it on the interface, but it's confusing when I see it addLong in the internal implementation.

thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant