Skip to content

Commit 8202352

Browse files
committed
Ensure that we create a long/ulong rather than a uint
1 parent 391d177 commit 8202352

File tree

1 file changed

+5
-5
lines changed
  • src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics

1 file changed

+5
-5
lines changed

src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ public static unsafe Vector128<double> ConvertToDouble(Vector128<long> vector)
376376
}
377377
else
378378
{
379-
lowerBits = Sse2.And(vector.AsInt32(), Create(0x00000000_FFFFFFFF).AsInt32());
380-
lowerBits = Sse2.Or(Create(0x43300000_00000000).AsInt32(), lowerBits);
379+
lowerBits = Sse2.And(vector, Create(0x00000000_FFFFFFFFL)).AsInt32();
380+
lowerBits = Sse2.Or(lowerBits, Create(0x43300000_00000000).AsInt32());
381381
}
382382

383383
var upperBits = Sse2.ShiftRightLogical(vector, 32); // Extract the 32 most significant bits of vector
@@ -423,12 +423,12 @@ public static unsafe Vector128<double> ConvertToDouble(Vector128<ulong> vector)
423423
if (Avx2.IsSupported)
424424
{
425425
lowerBits = vector.AsUInt32();
426-
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) */
426+
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)
427427
}
428428
else
429429
{
430-
lowerBits = Sse2.And(vector.AsUInt32(), Create(0x00000000_FFFFFFFF).AsUInt32());
431-
lowerBits = Sse2.Or(Create(0x43300000_00000000UL).AsUInt32(), lowerBits);
430+
lowerBits = Sse2.And(vector, Create(0x00000000_FFFFFFFFUL)).AsUInt32();
431+
lowerBits = Sse2.Or(lowerBits, Create(0x43300000_00000000UL).AsUInt32());
432432
}
433433

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

0 commit comments

Comments
 (0)