()
| 369 | } |
| 370 | |
| 371 | private ulong ComputeVersionHash() |
| 372 | { |
| 373 | const ulong offsetBasis = 14695981039346656037UL; |
| 374 | const ulong prime = 1099511628211UL; |
| 375 | |
| 376 | static ulong MixByte(ulong hash, byte value) |
| 377 | { |
| 378 | const ulong p = 1099511628211UL; |
| 379 | return (hash ^ value) * p; |
| 380 | } |
| 381 | |
| 382 | static ulong MixBool(ulong hash, bool value) |
| 383 | { |
| 384 | return MixByte(hash, value ? (byte)1 : (byte)0); |
| 385 | } |
| 386 | |
| 387 | static ulong MixUInt32(ulong hash, uint value) |
| 388 | { |
| 389 | hash = MixByte(hash, unchecked((byte)(value & 0xFF))); |
| 390 | hash = MixByte(hash, unchecked((byte)((value >> 8) & 0xFF))); |
| 391 | hash = MixByte(hash, unchecked((byte)((value >> 16) & 0xFF))); |
| 392 | hash = MixByte(hash, unchecked((byte)((value >> 24) & 0xFF))); |
| 393 | return hash; |
| 394 | } |
| 395 | |
| 396 | static ulong MixUInt64(ulong hash, ulong value) |
| 397 | { |
| 398 | hash = MixByte(hash, unchecked((byte)(value & 0xFF))); |
| 399 | hash = MixByte(hash, unchecked((byte)((value >> 8) & 0xFF))); |
| 400 | hash = MixByte(hash, unchecked((byte)((value >> 16) & 0xFF))); |
| 401 | hash = MixByte(hash, unchecked((byte)((value >> 24) & 0xFF))); |
| 402 | hash = MixByte(hash, unchecked((byte)((value >> 32) & 0xFF))); |
| 403 | hash = MixByte(hash, unchecked((byte)((value >> 40) & 0xFF))); |
| 404 | hash = MixByte(hash, unchecked((byte)((value >> 48) & 0xFF))); |
| 405 | hash = MixByte(hash, unchecked((byte)((value >> 56) & 0xFF))); |
| 406 | return hash; |
| 407 | } |
| 408 | |
| 409 | static ulong MixString(ulong hash, string? value) |
| 410 | { |
| 411 | if (value is null) |
| 412 | { |
| 413 | return MixUInt32(hash, uint.MaxValue); |
| 414 | } |
| 415 | |
| 416 | hash = MixUInt32(hash, unchecked((uint)value.Length)); |
| 417 | for (int i = 0; i < value.Length; i++) |
| 418 | { |
| 419 | char c = value[i]; |
| 420 | hash = MixByte(hash, unchecked((byte)(c & 0xFF))); |
| 421 | hash = MixByte(hash, unchecked((byte)(c >> 8))); |
| 422 | } |
| 423 | |
| 424 | return hash; |
| 425 | } |
| 426 | |
| 427 | static ulong MixFieldType(ulong hash, TypeMetaFieldType fieldType) |
| 428 | { |
nothing calls this directly
no test coverage detected