You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to add a new feature that focus on performing addition of 2 numbers irrespective of type (int,int) or (long,long) or (short,short). that too with the help of bitwise operators(^,&).
similarly for checking whether the number is even or odd. using & operator.
Note: The above 2 features will not work for double/floating point numbers It will work only for whole/natural numbers.
so, these are the above 2 features I would like to add to the Guava Math library.
2. What's the best code you can write to accomplish that without the new feature?
(Optional) What would the method signatures for your feature look like?
// for addition of two numbers.publicintadd(intvalue1,intvalue2);
publiclongadd(longvalue1,longvalue2);
publicshortadd(shortvalue1,shortvalue2);
//for even number checkpublicintisEven(intvalue);
publiclongisEven(longvalue);
publicshortisEven(shortvalue);
As discussed in #6982 (comment), the performance argument for the bitwise addition operations these is difficult to believe. For previous discussion of isEven, see #1229.
1. What are you trying to do?
2. What's the best code you can write to accomplish that without the new feature?
ExisitingFeature.txt
3. What would that same code look like if we added your feature?
NewFeature.txt
(Optional) What would the method signatures for your feature look like?
Concrete Use Cases
use-case.txt
Packages
com.google.common.math
Checklist
I agree to follow the code of conduct.
I have read and understood the contribution guidelines.
I have read and understood Guava's philosophy, and I strongly believe that this proposal aligns with it.
I have visited the idea graveyard, and did not see anything similar to this idea.
The text was updated successfully, but these errors were encountered: