Closed TimothyMakkison closed 1 year ago
Used Unsafe.WriteUnaligned to write the Ulid object to the array.
Unsafe.WriteUnaligned
Ulid
Removed the usage of ToByteArray, instead directly accessing the fields of both objects, comparing each value.
ToByteArray
Used Unsafe.As to partially compare the Ulid internals as long values. This is a fallback for older versions.
Unsafe.As
long
Used bitwise hacks to shuffle the bytes into a padded long. Added a IsLittleEndian check because I suspect it wouldn't work on BE devices.
IsLittleEndian
ToByteArray
Used
Unsafe.WriteUnaligned
to write theUlid
object to the array.CompareTo
Removed the usage of
ToByteArray
, instead directly accessing the fields of both objects, comparing each value.Equals
Used
Unsafe.As
to partially compare theUlid
internals aslong
values. This is a fallback for older versions.Get Time
Used bitwise hacks to shuffle the bytes into a padded
long
. Added aIsLittleEndian
check because I suspect it wouldn't work on BE devices.