mirror of
https://github.com/google/leveldb.git
synced 2025-03-12 09:40:10 +08:00
Merge pull request #1249 from victorvianna:main
PiperOrigin-RevId: 721407764
This commit is contained in:
commit
ac691084fd
@ -51,6 +51,9 @@ class LEVELDB_EXPORT Slice {
|
||||
// Return true iff the length of the referenced data is zero
|
||||
bool empty() const { return size_ == 0; }
|
||||
|
||||
const char* begin() const { return data(); }
|
||||
const char* end() const { return data() + size(); }
|
||||
|
||||
// Return the ith byte in the referenced data.
|
||||
// REQUIRES: n < size()
|
||||
char operator[](size_t n) const {
|
||||
|
@ -27,7 +27,7 @@ uint32_t Hash(const char* data, size_t n, uint32_t seed) {
|
||||
uint32_t h = seed ^ (n * m);
|
||||
|
||||
// Pick up four bytes at a time
|
||||
while (data + 4 <= limit) {
|
||||
while (limit - data >= 4) {
|
||||
uint32_t w = DecodeFixed32(data);
|
||||
data += 4;
|
||||
h += w;
|
||||
|
Loading…
Reference in New Issue
Block a user