/// <summary>Convert a 96-bits UUID into a 96-bits VersionStamp</summary> public static VersionStamp FromUuid96(Uuid96 value) { unsafe { byte *ptr = stackalloc byte[Uuid80.SizeOf]; value.WriteToUnsafe(ptr); ReadUnsafe(ptr, 12, out var vs); return(vs); } }
/// <summary>Convert a 96-bits UUID into a 96-bits VersionStamp</summary> public static VersionStamp FromUuid96(Uuid96 value) { unsafe { Span <byte> buf = stackalloc byte[Uuid96.SizeOf]; // 12 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(Uuid96 uuid, bool incomplete) { unsafe { byte *ptr = stackalloc byte[12]; uuid.WriteToUnsafe(ptr); ulong version = UnsafeHelpers.LoadUInt64BE(ptr); ushort order = UnsafeHelpers.LoadUInt16BE(ptr + 8); ushort userVersion = UnsafeHelpers.LoadUInt16BE(ptr + 10); return(new VersionStamp(version, order, userVersion, incomplete ? (ushort)(FLAGS_IS_INCOMPLETE | FLAGS_HAS_VERSION) : FLAGS_HAS_VERSION)); } }