-
Notifications
You must be signed in to change notification settings - Fork 543
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
List.count returns a negative value for huge lists #1143
Comments
Ideally it should even be |
Yeah, I wondered about |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Although, if you have enough memory, Wren allows you to create lists with up to UINT32_MAX (4,294,967,295) elements, I noticed today that if you go above INT32_MAX (2,147,483,647) then
List.count
returns a negative value:I tracked this down to
list_count
returninglist->elements.count
which is anint
and, on my system (Ubuntu 22.04, x64, GCC), that's a 32 bit signed integer.On the face of it the type of
count
(a field ofValueBuffer
) should really beuint32_t
though as this is something which is defined deep in the bowels of the VM code, I'm not sure what repercussions there would be if we changed it. It might affect negative indexing perhaps.Of course, it's not a big problem in practice but it's something to bear in mind if you need to create huge lists for some purpose.
The text was updated successfully, but these errors were encountered: