Skip to content

Commit

Permalink
add Armv6 and Ppc64le architectures support (dotnet#2219)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsitnik authored Dec 5, 2022
1 parent d383135 commit b401505
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
12 changes: 11 additions & 1 deletion src/BenchmarkDotNet/Environments/Platform.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ public enum Platform
/// <summary>
/// LOONGARCH64
/// </summary>
LoongArch64
LoongArch64,

/// <summary>
/// A 32-bit ARMv6 processor architecture.
/// </summary>
Armv6,

/// <summary>
/// A PowerPC 64-bit (little-endian) processor architecture.
/// </summary>
Ppc64le,
}
}
10 changes: 8 additions & 2 deletions src/BenchmarkDotNet/Portability/RuntimeInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,13 @@ internal static Runtime GetCurrentRuntime()

public static Platform GetCurrentPlatform()
{
// these are not part of .NET Standard 2.0, so we use a hack
// https://github.com/dotnet/runtime/blob/d81ad044fa6830f5f31f6b6e8224ebf66a3c298c/src/libraries/System.Runtime.InteropServices.RuntimeInformation/src/System/Runtime/InteropServices/RuntimeInformation/Architecture.cs#L12-L13
// these are not part of .NET Standard 2.0, so we use hardcoded values taken from
// https://github.com/dotnet/runtime/blob/1a37caf773a3b857ccff49a31be3333d4fdc491f/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs#L9
const Architecture Wasm = (Architecture)4;
const Architecture S390x = (Architecture)5;
const Architecture LoongArch64 = (Architecture)6;
const Architecture Armv6 = (Architecture)7;
const Architecture Ppc64le = (Architecture)8;

switch (ProcessArchitecture)
{
Expand All @@ -285,6 +287,10 @@ public static Platform GetCurrentPlatform()
return Platform.S390x;
case LoongArch64:
return Platform.LoongArch64;
case Armv6:
return Platform.Armv6;
case Ppc64le:
return Platform.Ppc64le;
default:
throw new ArgumentOutOfRangeException();
}
Expand Down

0 comments on commit b401505

Please sign in to comment.