Merge pull request #216 from XrXr/use-memcpy-to-do-unaligned-read

Use memcpy to perform unaligned reads
pull/13171/head
Joshua Haberman 5 years ago committed by GitHub
commit abdf14937d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      upb/table.c

@ -756,7 +756,8 @@ uint32_t upb_murmur_hash2(const void *key, size_t len, uint32_t seed) {
/* Mix 4 bytes at a time into the hash */
const uint8_t * data = (const uint8_t *)key;
while(len >= 4) {
uint32_t k = *(uint32_t *)data;
uint32_t k;
memcpy(&k, data, sizeof(k));
k *= m;
k ^= k >> r;

Loading…
Cancel
Save