Skip to content
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

Make BitWidth use NonZeroUsize #39

Open
AaronKutch opened this issue Jul 11, 2019 · 3 comments
Open

Make BitWidth use NonZeroUsize #39

AaronKutch opened this issue Jul 11, 2019 · 3 comments

Comments

@AaronKutch
Copy link
Contributor

The compiler has special optimizations for this. In fact, I might just replace BitWidth altogether, but I will have to try that in an experimental branch in the future.

@Robbepop
Copy link
Owner

I was also already thinking about this and also to use other things such as MaybeUninit, ManuallyDrop. I think apint could make use a lot more of those new abstractions.

@AaronKutch
Copy link
Contributor Author

Yeah. I learned a bunch about manipulating pointers and using MaybeUninit when working on my ptr_rotate PR, so I will do this.

@AaronKutch
Copy link
Contributor Author

I was considering replacing BitWidth altogether with NonZeroUsize, but I have decided to keep it as a wrapper type around a NonZeroUsize. I found it unlikely that we would use unused bits in the len, but someone might want to clone the library and use NonZeroU32 or something else special.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants