Compute MD5Hash the same way LLVM does: MD5 digest, return first 8 bytes as little-endian uint64. This matches IndexedInstrProf::ComputeHash() which is used to compute FilenamesRef.
| 25 | /// Compute MD5Hash the same way LLVM does: MD5 digest, return first 8 bytes as little-endian uint64. |
| 26 | /// This matches IndexedInstrProf::ComputeHash() which is used to compute FilenamesRef. |
| 27 | uint64_t computeMD5Hash(const uint8_t * data, size_t len) |
| 28 | { |
| 29 | unsigned char digest[MD5_DIGEST_LENGTH]; // NOLINT |
| 30 | MD5(data, len, digest); // NOLINT |
| 31 | uint64_t result; |
| 32 | memcpy(&result, digest, 8); |
| 33 | return result; |
| 34 | } |
| 35 | |
| 36 | /// Read an unsigned LEB128 value from buf, advance buf, return value. |
| 37 | /// Sets ok = false and returns 0 on truncated input or overflow. |
no test coverage detected