Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
897fdb9
Adding barebones Int128 and UInt128 structs
tannergooding Apr 11, 2022
2fe1618
Special case Int128 and UInt128 alignment on x64 Unix and Arm64
tannergooding May 2, 2022
6559609
Implementing Int128 and UInt128
tannergooding May 3, 2022
2c820b5
Adding tests for Int128 and UInt128
tannergooding May 7, 2022
e7970fb
Updating Int128/UInt128 to respect the System V ABI ordering
tannergooding May 11, 2022
828440f
Merge remote-tracking branch 'dotnet/main' into generic-math-int128
tannergooding May 11, 2022
6904e73
Fixing an issue with UInt128->BigInteger setting the wrong sign
tannergooding May 12, 2022
bcbc375
Merge remote-tracking branch 'dotnet/main' into generic-math-int128
tannergooding May 12, 2022
09e8bfc
Don't use Unsafe.As in the Int128/UInt128 hex parsing logic
tannergooding May 12, 2022
5f9d22f
Adding Int128 P/Invoke tests and ensure R2R correctly sets the packing
tannergooding May 13, 2022
b6b85e6
Fixing some issues with the Int128 interop test for non-Windows
tannergooding May 13, 2022
9de4e76
Ensure that floating-point conversions exist for Int128 and UInt128
tannergooding May 13, 2022
a1dc14f
Fixing the casing of a couple fields
tannergooding May 16, 2022
7666952
Revert "Don't use Unsafe.As in the Int128/UInt128 hex parsing logic"
tannergooding May 16, 2022
f0a30cb
Adjusting the Int128/UInt128 generic math tests to have consistent or…
tannergooding May 16, 2022
cb5a82e
Responding to PR feedback
tannergooding May 18, 2022
384e572
Ensure that pNativeLayoutInfo alignment is initialized for Int128/UIn…
tannergooding May 18, 2022
ab85c7b
Don't use Unsafe.As in the Int128/UInt128 hex parsing logic
tannergooding May 12, 2022
163cfda
Merge remote-tracking branch 'dotnet/main' into generic-math-int128
tannergooding May 19, 2022
cd3c9e9
Skip the Interop/PInvoke/Int128 tests on Mono
tannergooding May 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixing some issues with the Int128 interop test for non-Windows
  • Loading branch information
tannergooding committed May 13, 2022
commit b6b85e6afd5a5b7be2a1837782cf09ae3eaaa38c
2 changes: 1 addition & 1 deletion src/libraries/System.Private.CoreLib/src/System/Int128.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public readonly struct Int128
// Unix System V ABI actually requires this to be little endian
// order and not `upper, lower` on big endian systems.

private readonly ulong _upper;
private readonly ulong _lower;
private readonly ulong _upper;

/// <summary>Initializes a new instance of the <see cref="Int128" /> struct.</summary>
/// <param name="upper">The upper 64-bits of the 128-bit value.</param>
Expand Down
12 changes: 11 additions & 1 deletion src/tests/Interop/PInvoke/Int128/Int128Native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE GetInt128(uint64_t upper, uint64_
{
Int128 result;

#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
result = upper;
result = result << 64;
result = result | lower;
#else
result.lower = lower;
result.upper = upper;
#endif

return result;
}
Expand All @@ -45,10 +51,14 @@ extern "C" DLL_EXPORT Int128 STDMETHODCALLTYPE AddInt128(Int128 lhs, Int128 rhs)
{
Int128 result;

#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
result = lhs + rhs;
#else
result.lower = lhs.lower + rhs.lower;
uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;

result.upper = lhs.upper + rhs.upper + carry;
#endif

return result;
}

Expand Down
1 change: 1 addition & 0 deletions src/tests/Interop/PInvoke/Int128/Int128Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DebugType>embedded</DebugType>
<OutputType>exe</OutputType>
</PropertyGroup>
<ItemGroup>
Expand Down
12 changes: 11 additions & 1 deletion src/tests/Interop/PInvoke/Int128/UInt128Native.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,14 @@ extern "C" DLL_EXPORT UInt128 STDMETHODCALLTYPE GetUInt128(uint64_t upper, uint6
{
UInt128 result;

#if (INT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
result = upper;
result = result << 64;
result = result | lower;
#else
result.lower = lower;
result.upper = upper;
#endif

return result;
}
Expand All @@ -45,10 +51,14 @@ extern "C" DLL_EXPORT UInt128 STDMETHODCALLTYPE AddUInt128(UInt128 lhs, UInt128
{
UInt128 result;

#if (UINT128_WIDTH == 128) || defined(__SIZEOF_INT128__)
result = lhs + rhs;
#else
result.lower = lhs.lower + rhs.lower;
uint64_t carry = (result.lower < lhs.lower) ? 1 : 0;

result.upper = lhs.upper + rhs.upper + carry;
#endif

return result;
}

Expand Down
3 changes: 3 additions & 0 deletions src/tests/issues.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3308,6 +3308,9 @@
<ExcludeList Include = "$(XunitTestBinBase)/Interop/ICustomMarshaler/ConflictingNames/SameNameDifferentAssembly/**">
<Issue>https://github.com/dotnet/runtime/issues/41519</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Interop/PInvoke/Int128/**">
<Issue>https://github.com/dotnet/runtime/issues/41519</Issue>
</ExcludeList>
<ExcludeList Include = "$(XunitTestBinBase)/Interop/PInvoke/Miscellaneous/HandleRef/HandleRefTest/**">
<Issue>https://github.com/dotnet/runtime/issues/41519</Issue>
</ExcludeList>
Expand Down