| 109 | |
| 110 | template<class P> |
| 111 | std::string GetTestParamHashHelper(const P &info) |
| 112 | { |
| 113 | // Let's use a hash of the parameter set as index. |
| 114 | test::HashMD5 hash; |
| 115 | Update(hash, info); |
| 116 | |
| 117 | // We don't need 64 bit worth of variation, 32-bit is enough and leads |
| 118 | // to shorter suffixes. |
| 119 | |
| 120 | union Cast |
| 121 | { |
| 122 | uint8_t array[16]; |
| 123 | uint64_t value[2]; |
| 124 | }; |
| 125 | |
| 126 | static_assert(sizeof(hash.getHashAndReset()) == sizeof(Cast::array)); |
| 127 | |
| 128 | Cast caster; |
| 129 | memcpy(caster.array, &hash.getHashAndReset()[0], sizeof(caster.array)); |
| 130 | |
| 131 | uint64_t code64 = caster.value[0] ^ caster.value[1]; |
| 132 | uint32_t code32 = (code64 & UINT32_MAX) ^ (code64 >> 32); |
| 133 | |
| 134 | std::ostringstream out; |
| 135 | out << std::hex << std::setw(sizeof(code32) * 2) << std::setfill('0') << code32; |
| 136 | return out.str(); |
| 137 | } |
| 138 | |
| 139 | } // namespace detail |
| 140 |
no test coverage detected