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

The maximum number of entities is inconsistent #220

Open
akhilman opened this issue Dec 12, 2021 · 2 comments
Open

The maximum number of entities is inconsistent #220

akhilman opened this issue Dec 12, 2021 · 2 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@akhilman
Copy link

In Entities::alloc we are trying to convert the total number of entities to u32, so the maximum number of entities is u32::MAX. In Entities::alloc_many we are directly comparing number to u32::MAX. But in Entities::reserve_entities, Entities::alloc_at, Entities::reserve and many other places in code iszie is used, so on a 32-bit system these functions expect the maximum number to be i32::MAX , which is half of u32::MAX. Entities::free_cursor is also AtomicIsize.

Is my observation correct? Is this intentional behaviour? Should iszie be replaced by i64?

@Ralith
Copy link
Owner

Ralith commented Dec 12, 2021

Unfortunately AtomicI64 sacrifices portability; see #204. It's possible that different interfaces will behave differently when dealing with numbers of entities above i32::MAX. I'd be happy to accept PRs to mitigate this or otherwise improve consistency, but I'm not convinced that supporting more than 2 billion entities is important.

@akhilman
Copy link
Author

Ok. Then the maximum number of entities should be limited by i32::MAX.

@akhilman akhilman changed the title [Question] What is a maximum number of entities The maximum number of entities is inconsistent Dec 13, 2021
@Ralith Ralith added enhancement New feature or request good first issue Good for newcomers labels Dec 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants