-
Notifications
You must be signed in to change notification settings - Fork 203
Removed bn_conversion.c in favor of individual files #311
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm OK now (the type-cast / negation order is not crucial, I even think that other compilers might disagree with MSVC ....)
They way it is done makes it a defined behaviour but does not solve the problem with overflow per se. Put a note in the documentation or is this behaviour obvious? |
3a60462
to
3f059fc
Compare
No. The way negation is done now solves the undefined behavior, since overflow of unsigned numbers is well defined. |
@czurnieden Before we had these MP_SET_XLONG macros, bn_conversion does the same. Keeping the macros might not make sense, all the macros are used only twice. If you want to fix #301, you could simply split bn_conversion in multiple files, keeping the macros. However we could think of supporting multiple functions per file as introduced in bn_deprecated.c and bn_conversion.c. This was in fact not my idea, but @sjaeckel suggested to put the deprecated stuff in a single file. But I think it is a good idea actually. For the bn_conversion case, splitting might make sense. |
Ah, misunderstanding.
The stuff in
The macros are not needed, they do not rely on many compile-time variables, they are just generating code. This PR keeps the necessary compile-time variables (constants actually, like e.g.: MP_DIGIT_BIT) and cuts it in individual files. It is just a different formatting, no change in functionality.
Yes. And?
Out of sync with what? With |
03089e0
to
527b02c
Compare
527b02c
to
32c9405
Compare
@czurnieden Do you think it makes sense to keep the macros to avoid this out of sync issue between the twins? The macros should be improved to be more readable however and get a type argument instead of a bit integer argument as @nijtmans suggested. |
@czurnieden Ok to close this in favor of #313? |
In reaction to #104 and #309.
It also makes development in #301 easier.