-
Notifications
You must be signed in to change notification settings - Fork 262
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
Fix big endian compatibility #7811
Conversation
@@ -14,6 +14,39 @@ Module: Read ELF | |||
|
|||
#include <istream> | |||
|
|||
static void u16_to_native_endian_inplace(bool le_input, uint16_t &input) |
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.
There is no variant of these in the standard library?
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.
There is htons
, but it's not in the standard library and it doesn't fully cover what is needed here!
We need to start searching from the least or most significant bit, the position of which depends on endianness.
Values checked for in some tests depend on endianness. Also, don't hard-code "byte_(extract|update)_little_endian and instead also accept the big-endian variant thereof.
This is pre-defined by GCC on _some_ platforms. Here, we don't want GCC pre-defined setting but instead want our own setting to test both little and big-endian settings.
We previously only supported little-endian architectures for some of the simplify_byte_update simplification rules.
Converting from integers to char arrays reveals endianness.
321dc37
to
bdd42d3
Compare
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #7811 +/- ##
===========================================
+ Coverage 78.13% 78.74% +0.61%
===========================================
Files 1698 1698
Lines 194027 194123 +96
===========================================
+ Hits 151600 152861 +1261
+ Misses 42427 41262 -1165
☔ View full report in Codecov by Sentry. |
Please review commit-by-commit.