-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 bitwise operations to BigNumber #781
Comments
No, it’s not exposed. If you npm the same version in your project, it should reuse the same copy during rollup though. The reason to not expose it is that some day I plan to remove it, and if people depend on it from ethers, than I can’t remove it without breaking them. It is very much meant to be internal. :) What functionality do you need? There shouldn’t be any methods normal ethereum development should need beyond was is exposed, I think? |
Very understandable, what's the long term BN strategy? I think it was missing some Bit operations that I needed, shift right/left/pow etc:
Would be nice to just use ethers here, and it's just a few methods I couldn't seem to find in ethers. Maybe I just didn't see them? |
I think something like this should do it #782 |
The That said, I can imaging people using a uint256 as a bit field (I have), so It prolly won’t happen right away though. Still trying to get the new docs ready first so I can finally release v5. :) |
Nice! I think a hefty explainer on the concerns of Bit Wise implementation concerns would be a nice addition to the docs. Secondly, what are you using for the docs? Same tech, or a new platform? |
One last thing... I really, really hate looking at and typing Why not just |
In v5, it’s For the most part though, you shouldn’t need to explicitly convert numbers to BigNumber, since most functions do that for you. The new docs are written in Flatworm, because as much as I advocate against re-inventing the wheel, I often fail to heed my own advice. I’m almost done refactoring it, so it will be easier to add full-text search and PDF output. :) |
@ricmoo I might use flatworm also, looks good, my own problem is it has too many dependancies. Why don't you trim it down a bit ;) |
Tests are running right now. I've restricted all operations to positive numbers. The The shift operations I also omitted arithmetic right shift, since it is not common and I need to think more about what it means in the context of arbitrary bit width. The Hopefully these all make sense and help. :) |
Published to 5.0.0-beta.181. Try it out and let me know if you have any problems. |
Thanks Richard!
…Sent from my iPhone
On Apr 15, 2020, at 7:21 PM, Richard Moore ***@***.***> wrote:
Published to 5.0.0-beta.181.
Try it out and let me know if you have any problems.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
Coolio. Closing this now. Thanks! :) |
I don't see |
Agreed. I’ll add them on the next docs pass. |
So what's the status on this? Still no bit-wise operations in the doc. |
Still no bitwise operations in the doc (for people who still want to use v5) |
Hey Richard,
Does ethers expose the plain BN object anywhere, there were some BN specific methods I need and it seems your wrapper doesn't include them (i think it was shifting).
Regardless, might be good to just expose the plain BN object for these pinch cases.
Best,
Nick
The text was updated successfully, but these errors were encountered: