forked from OSchip/llvm-project
[MappedHash] Fix alignment violations
This fixes a few alignment problems pointed out by UBSan, and is otherwise NFC. llvm-svn: 319934
This commit is contained in:
parent
efb5024e57
commit
a73324b0a9
|
@ -357,21 +357,24 @@ public:
|
|||
}
|
||||
|
||||
uint32_t GetHashIndex(uint32_t bucket_idx) const {
|
||||
uint32_t result = UINT32_MAX;
|
||||
if (m_hash_indexes && bucket_idx < m_header.bucket_count)
|
||||
return m_hash_indexes[bucket_idx];
|
||||
return UINT32_MAX;
|
||||
memcpy(&result, m_hash_indexes + bucket_idx, sizeof(uint32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t GetHashValue(uint32_t hash_idx) const {
|
||||
uint32_t result = UINT32_MAX;
|
||||
if (m_hash_values && hash_idx < m_header.hashes_count)
|
||||
return m_hash_values[hash_idx];
|
||||
return UINT32_MAX;
|
||||
memcpy(&result, m_hash_values + hash_idx, sizeof(uint32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t GetHashDataOffset(uint32_t hash_idx) const {
|
||||
uint32_t result = UINT32_MAX;
|
||||
if (m_hash_offsets && hash_idx < m_header.hashes_count)
|
||||
return m_hash_offsets[hash_idx];
|
||||
return UINT32_MAX;
|
||||
memcpy(&result, m_hash_offsets + hash_idx, sizeof(uint32_t));
|
||||
return result;
|
||||
}
|
||||
|
||||
bool Find(const char *name, Pair &pair) const {
|
||||
|
|
Loading…
Reference in New Issue