LLVM: lib/DebugInfo/PDB/Native/Hash.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
13#include
14
15using namespace llvm;
17
18
19
23
26
27 for (auto Value : Longs)
29
30 const uint8_t *Remainder = reinterpret_cast<const uint8_t *>(Longs.end());
32
33
34
35 if (RemainderSize >= 2) {
38 Remainder += 2;
39 RemainderSize -= 2;
40 }
41
42
43 if (RemainderSize == 1) {
44 Result ^= *(Remainder++);
45 }
46
47 const uint32_t toLowerMask = 0x20202020;
48 Result |= toLowerMask;
49 Result ^= (Result >> 11);
50
51 return Result ^ (Result >> 16);
52}
53
54
55
58
60
65 Hash += Item;
66 Hash += (Hash << 10);
67 Hash ^= (Hash >> 6);
68 }
70 for (uint8_t Item : Buffer) {
71 Hash += Item;
72 Hash += (Hash << 10);
73 Hash ^= (Hash >> 6);
74 }
75
76 return Hash * 1664525U + 1013904223U;
77}
78
79
81 JamCRC JC(0U);
84}
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
void update(ArrayRef< uint8_t > Data)
StringRef - Represent a constant reference to a string, i.e.
LLVM Value Representation.
uint32_t hashStringV1(StringRef Str)
uint32_t hashBufferV8(ArrayRef< uint8_t > Data)
uint32_t hashStringV2(StringRef Str)
detail::packed_endian_specific_integral< uint32_t, llvm::endianness::little, unaligned > ulittle32_t
This is an optimization pass for GlobalISel generic memory operations.