| 397 | } |
| 398 | |
| 399 | static void transformUUID(const UUID & src_uuid, UUID & dst_uuid, UInt64 seed) |
| 400 | { |
| 401 | auto src_copy = src_uuid; |
| 402 | transformEndianness<std::endian::little, std::endian::native>(src_copy); |
| 403 | |
| 404 | const UInt128 & src = src_copy.toUnderType(); |
| 405 | UInt128 & dst = dst_uuid.toUnderType(); |
| 406 | |
| 407 | SipHash hash; |
| 408 | hash.update(seed); |
| 409 | hash.update(reinterpret_cast<const char *>(&src), sizeof(UUID)); |
| 410 | |
| 411 | /// Saving version and variant from an old UUID |
| 412 | dst = hash.get128(); |
| 413 | |
| 414 | const UInt64 trace[2] = {0x000000000000f000ull, 0xe000000000000000ull}; |
| 415 | UUIDHelpers::getLowBytes(dst_uuid) = (UUIDHelpers::getLowBytes(dst_uuid) & (0xffffffffffffffffull - trace[1])) | (UUIDHelpers::getLowBytes(src_uuid) & trace[1]); |
| 416 | UUIDHelpers::getHighBytes(dst_uuid) = (UUIDHelpers::getHighBytes(dst_uuid) & (0xffffffffffffffffull - trace[0])) | (UUIDHelpers::getHighBytes(src_uuid) & trace[0]); |
| 417 | } |
| 418 | |
| 419 | class FixedStringModel : public IModel |
| 420 | { |
no test coverage detected