/// <summary>Convert a 80-bits UUID into a 80-bits VersionStamp</summary> public static VersionStamp FromUuid80(Uuid80 value) { unsafe { byte *ptr = stackalloc byte[16]; // 10 required value.WriteToUnsafe(ptr); ReadUnsafe(ptr, 10, out var vs); return(vs); } }
/// <summary>Convert a 80-bits UUID into a 80-bits VersionStamp</summary> public static VersionStamp FromUuid80(Uuid80 value) { unsafe { Span <byte> buf = stackalloc byte[Uuid80.SizeOf]; // 10 required value.WriteToUnsafe(buf); ReadUnsafe(buf, out var vs); return(vs); } }
/// <summary>Creates a 96-bit <see cref="VersionStamp"/>.</summary> /// <returns>Complete stamp, with a user version.</returns> public static VersionStamp Custom(Uuid80 uuid, ushort userVersion, bool incomplete) { unsafe { byte *ptr = stackalloc byte[10]; uuid.WriteToUnsafe(ptr); ulong version = UnsafeHelpers.LoadUInt64BE(ptr); ushort order = UnsafeHelpers.LoadUInt16BE(ptr + 8); return(new VersionStamp(version, order, userVersion, incomplete ? (ushort)(FLAGS_IS_INCOMPLETE | FLAGS_HAS_VERSION) : FLAGS_HAS_VERSION)); } }
/// <summary>Creates a 96-bit <see cref="VersionStamp"/>.</summary> /// <returns>Complete stamp, with a user version.</returns> public static VersionStamp Custom(Uuid80 uuid, bool incomplete) { unsafe { byte *ptr = stackalloc byte[10]; uuid.WriteToUnsafe(ptr); ulong version = UnsafeHelpers.LoadUInt64BE(ptr); ushort order = UnsafeHelpers.LoadUInt16BE(ptr + 8); return(new VersionStamp(version, order, NO_USER_VERSION, incomplete ? FLAGS_IS_INCOMPLETE : FLAGS_NONE)); } }