Skip to content

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