-
Notifications
You must be signed in to change notification settings - Fork 214
Use MP_SIZEOF_BITS for MP_WARRAY definition #329
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
Conversation
…s, remove unnecessary includes
|
mp_sizeof_bits cannot be used in tommath.h since it is private |
Indeed. Fixed now. In addition, I think MP_SIZEOF_BITS() should return an int, not size_t, since it is used to compare against other integers, generally. Follow-up commits demonstrate more simplifications doing that. |
|
I think we should rather use size_t at more places instead of int. sizeof_bits should return size_t like sizeof. |
If MP_SIZEOF_BITS was a public macro, I would agree with you on that. But MP_SIZEOF_BITS() is used internally, usually comparing with mp_int->used or mp_int->alloc, which are integers. That results in type-casts in the code, that could better be handled in MP_SIZEOF_BITS. This branch is meant to prove that: showing that changing MP_SIZEOF_BITS results in less type-casts in the code. Making it more readable. But .... if you are fond of type-casts .... ;-) |
I think so too
so instead of making sizeof_bits return the wrong type we will change these types to size_t after 1.2.0 is released. This should make both of you happy and @karel-m unfortunately a bit sadder ... :-\ |
|
If there are plans to change mp_int->used and mp_int->alloc from int to size_t, yes that would make me happy (although it's binary incompatible on 64-bit platforms, so that cannot be done in 1.x) But - anyway - I'll close this one, if there are such plans, this PR makes no sense. |
Also fix depreciation messages and remove unnecessary includes.
Just some random improvements, not worth to split in 3 different pull requests.
Inspired by #327