-
-
Notifications
You must be signed in to change notification settings - Fork 368
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
Extract values in HIDParse correctly when compiled in 64-bit (LP64) mode #1024
Extract values in HIDParse correctly when compiled in 64-bit (LP64) mode #1024
Conversation
Reworks the conversion of bytes in little-endian order to host order to operate independently of the sizeof(long) and the byte-order of the host system. The extracted value is stored as uint32_t as the code already performs casts to signed/unsigned of varying sizes as appropriate to the context of use.
See withdrawn/closed PR #1016 for additional discussion. |
Thanks, so in this incarnation, does the byte-stream-to-number conversion work reasonably for all host types and word lengths involved? |
Yes, the new conversion of a little-endian number in the byte stream is independent of word size (32/64 bit) and endian-ness. It doesn't address the bug I raised in issue #1023 which will need some more thought. |
Just in case - is it also producing numbers as expected for shorter integers (8, 16 bits), in particular with no garbage in uninitialized memory of bytes not touched? Seems all should be OK, but better double-checked than sorry :) |
Yes, there is no possibility of there being uninitialized bytes in the result as the entire result ( This code is used to parse the report descriptors but not the values that the UPS reports back as its state changes (that's |
…ogMin/LogMax error origins [networkupstools#1024, networkupstools#1512, networkupstools#2718] Signed-off-by: Jim Klimov <jimklimov+nut@gmail.com>
Reworks the conversion of bytes in little-endian order to host order to
operate independently of the sizeof(long) and the byte-order of the host system.
The extracted value is stored as uint32_t as the code already performs casts
to signed/unsigned of varying sizes as appropriate to the context of use.
Closes issue #1015