-
Notifications
You must be signed in to change notification settings - Fork 115
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
Possible issue when importing 8-bit chunks into cpp_int #488
Comments
It is present in 1.80 and on develop as well. |
I have a trivial fix, but need to devise a portable test case (which is somewhat harder). The issue is triggered by std::array<>::const_iterator being a pointer in gcc, and the fact that you're only importing the first byte of each value and not the whole thing, it's a check for the latter which is missing in the gcc case. |
Thank you John! |
Well, I ran into the following phenomenon today.
While doing some in-depth testing of
cpp_int
's facility forimport_bits()
, I found what seems to be a potential bug. It is only in GCC, not in MSVC (did not try clang yet).Anyway, when importing a
chunk_size
or 8 from an array of 16-bit unsigned integers, and only formsv_first
beingfalse
, the import function seems to be optimized and imports too large of chunks.I would like to retain the optimization, but maybe it needs improved logic. It seems to be independent of singed/unsigned versions of
char
. Yet I can't quite figure out why MSVC gets it OK, but GCC does not.The entire code is below.
The link to Wandbox is here.
The text was updated successfully, but these errors were encountered: