Skip to content

Commit

Permalink
Ensure that we create a long/ulong rather than a uint
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Jan 3, 2022
1 parent 391d177 commit 8202352
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,8 @@ public static unsafe Vector128<double> ConvertToDouble(Vector128<long> vector)
}
else
{
lowerBits = Sse2.And(vector.AsInt32(), Create(0x00000000_FFFFFFFF).AsInt32());
lowerBits = Sse2.Or(Create(0x43300000_00000000).AsInt32(), lowerBits);
lowerBits = Sse2.And(vector, Create(0x00000000_FFFFFFFFL)).AsInt32();
lowerBits = Sse2.Or(lowerBits, Create(0x43300000_00000000).AsInt32());
}

var upperBits = Sse2.ShiftRightLogical(vector, 32); // Extract the 32 most significant bits of vector
Expand Down Expand Up @@ -423,12 +423,12 @@ public static unsafe Vector128<double> ConvertToDouble(Vector128<ulong> vector)
if (Avx2.IsSupported)
{
lowerBits = vector.AsUInt32();
lowerBits = Avx2.Blend(lowerBits, Create(0x43300000_00000000UL).AsUInt32(), 0b1010); // Blend the 32 lowest significant bits of vector with the bit representation of double(2^52) */
lowerBits = Avx2.Blend(lowerBits, Create(0x43300000_00000000UL).AsUInt32(), 0b1010); // Blend the 32 lowest significant bits of vector with the bit representation of double(2^52)
}
else
{
lowerBits = Sse2.And(vector.AsUInt32(), Create(0x00000000_FFFFFFFF).AsUInt32());
lowerBits = Sse2.Or(Create(0x43300000_00000000UL).AsUInt32(), lowerBits);
lowerBits = Sse2.And(vector, Create(0x00000000_FFFFFFFFUL)).AsUInt32();
lowerBits = Sse2.Or(lowerBits, Create(0x43300000_00000000UL).AsUInt32());
}

var upperBits = Sse2.ShiftRightLogical(vector, 32); // Extract the 32 most significant bits of vector
Expand Down

0 comments on commit 8202352

Please sign in to comment.