-
Notifications
You must be signed in to change notification settings - Fork 278
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
Add bounds check on UnsignedLongs #312
Comments
Here is a proposal via Cava: ConsenSysMesh/cava#173 |
Here is the issue where this will be debated: |
I'm thinking that we might want to switch to Cava's uint64 type now that it is backed by long and has implemented some convenience methods for overflow detection |
@jrhea, has this been completed or is it still an open issue? |
@akhila-raju it is still an open issue. I think we want to replace unsigned long with uint64 from cava. Antoine created an implementation that didn't rely on big integer |
For the sake of easier code readability and maintainability, we have decided to switch to long, since mathematical functions (addition, subtraction, multiplication, division, modulo, amongst others) are already supported by Java for longs. Every time we use an UnsignedLong to index an array, it has to be cast to an integer. Java already has long to int cast support. If we were to keep UnsignedLong, there would be many files we would have to maintain, including SSZ implementation for UnsignedLong, all supporting mathematical functions implemented for UnsignedLong, etc. It's unnecessary overhead since integer indexes are the major limiting factor of using UnsignedLong. Thus, to keep it simpler, we have decided, going forward, to use Java's native long rather than UnsignedLong. |
Description
I want to augment UnsignedLong's capabilities with extension methods, but Java doesn't support these natively. Investigate the use of Manifold (or some other method) to give us the desired functionality.
http://manifold.systems/docs.html#extension-method-basics
I would like to have an easy way to do a bounds check on UnsignedLongs automatically when we do an UnsignedLong.plus() or UnsignedLong.minus().
Acceptance Criteria
Add the following extension methods to UnsignedLong:
The text was updated successfully, but these errors were encountered: