Skip to content

build: Drop endianess workaround #64

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fanquake
Copy link

This mirrors a change in leveldb: google/leveldb@201f522, now that compilers can better optimise the generic code.

This mirrors a change in leveldb:
google/leveldb@201f522,
now that compilers can better optimise the generic code.
@DennisHeimbigner
Copy link

I cannot figure out the endianness of the resulting checksum.
Does it always return a specific endianness (big or little) result or does it return
a value consistent with the native endianness of the machine on which it is computed?

std::memcpy(&result, buffer, sizeof(result));
return result;
#endif // BYTE_ORDER_BIG_ENDIAN
return ((static_cast<uint16_t>(static_cast<uint8_t>(buffer[0]))) |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buffer is of type const uint8_t*.
buffer[0] is of type uint8_t.
Hence, the explicit conversion static_cast<uint8_t>(buffer[0]) is redundant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants