| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // Copyright (c) 2021-2025 ChilliBits. All rights reserved. | ||
| 2 | |||
| 3 | #pragma once | ||
| 4 | |||
| 5 | #include <symboltablebuilder/QualType.h> | ||
| 6 | #include <symboltablebuilder/Type.h> | ||
| 7 | #include <symboltablebuilder/TypeChain.h> | ||
| 8 | |||
| 9 | namespace spice::compiler { | ||
| 10 | |||
| 11 | uint64_t hashMix(uint64_t hash) noexcept; | ||
| 12 | |||
| 13 | void hashCombine64(uint64_t &hash, uint64_t value) noexcept; | ||
| 14 | |||
| 15 | 8365238 | template <typename T> uint64_t hashValue(const T &value) noexcept { return static_cast<uint64_t>(std::hash<T>{}(value)); } | |
| 16 | |||
| 17 | template <typename T> | ||
| 18 | 869907 | uint64_t hashPointer(const T *value) noexcept { | |
| 19 | 869907 | return reinterpret_cast<uint64_t>(value) >> 3; | |
| 20 | } | ||
| 21 | |||
| 22 | 23275135 | template <typename T> uint64_t hashVector(const std::vector<T> &vec) noexcept { | |
| 23 | 23275135 | uint64_t hash = 0; | |
| 24 |
4/4unsigned long spice::compiler::hashVector<spice::compiler::TypeChainElement>(std::vector<spice::compiler::TypeChainElement, std::allocator<spice::compiler::TypeChainElement> > const&):
✓ Branch 9 → 4 taken 7775065 times.
✓ Branch 9 → 10 taken 7606341 times.
unsigned long spice::compiler::hashVector<spice::compiler::QualType>(std::vector<spice::compiler::QualType, std::allocator<spice::compiler::QualType> > const&):
✓ Branch 9 → 4 taken 590173 times.
✓ Branch 9 → 10 taken 15668794 times.
|
31640373 | for (const T &item : vec) |
| 25 | 8365238 | hashCombine64(hash, hashValue(item)); | |
| 26 | 23275135 | return hash; | |
| 27 | } | ||
| 28 | |||
| 29 | } // namespace spice::compiler | ||
| 30 | |||
| 31 | namespace std { | ||
| 32 | |||
| 33 | // Implement hash functionality for the TypeChainElement struct | ||
| 34 | template <> struct hash<spice::compiler::TypeChainElement> { | ||
| 35 | size_t operator()(const spice::compiler::TypeChainElement &tce) const noexcept; | ||
| 36 | }; | ||
| 37 | |||
| 38 | // Implement hash functionality for the Type class | ||
| 39 | template <> struct hash<spice::compiler::Type> { | ||
| 40 | size_t operator()(const spice::compiler::Type &t) const noexcept; | ||
| 41 | }; | ||
| 42 | |||
| 43 | // Implement hash functionality for the TypeQualifiers class | ||
| 44 | template <> struct hash<spice::compiler::TypeQualifiers> { | ||
| 45 | size_t operator()(const spice::compiler::TypeQualifiers &qualifiers) const noexcept; | ||
| 46 | }; | ||
| 47 | |||
| 48 | // Implement hash functionality for the QualType class | ||
| 49 | template <> struct hash<spice::compiler::QualType> { | ||
| 50 | size_t operator()(const spice::compiler::QualType &qualType) const noexcept; | ||
| 51 | }; | ||
| 52 | |||
| 53 | } // namespace std | ||
| 54 |