-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Use of int for internal counter #31
Comments
I believe this would be possible now. However, it would require a performance optimized version of It would also require an implementation of So the options would be to roll my own versions of the above functions (which makes me a little nervous, but is very feasible with enough testing -- I've definitely hit weird unexpected edge case bugs here in the past due to obscure int/uint behaviors so testing is required), or wait ~9mo and roll a v3 version of this library that requires >=go1.22. FWIW I already planned to do so upon release of go1.23 (I target at least stable and 'oldstable') in order to use the new Thoughts welcome. (I'm also curious what the use case is where you frequently need to be able to exceed maxInt64 with weights -- as I'm guessing a |
Sounds good. The use case i have is cryptocurrency related. The weight is a number of coins. The total coins on the network wont exceed MaxInt64 for 100 years so Int64 is fine, but in theory the number could go higher. |
Wouldn't it make more sense to use a
uint64
for thetotal
andmax
fields inside the chooser?As it stands you allow the user to use a
uint64
for the weight but the max weight total cannot exceed amaxInt
. And thatmaxInt
is different for users on 32 and 64 bit systems creating uncertainty in how the software will run on users computers.I've had a bug report of my software being unable to run on 32 bit systems because I need the total weight to exceed a
maxInt32
(and ideallymaxInt64
for that matter).It seems like if you're going to allow
uint64
s as weights then internally the counter should be able to handle that maximum value.The text was updated successfully, but these errors were encountered: