Skip to content

Commit b401505

Browse files
authored
add Armv6 and Ppc64le architectures support (#2219)
1 parent d383135 commit b401505

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

src/BenchmarkDotNet/Environments/Platform.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ public enum Platform
4040
/// <summary>
4141
/// LOONGARCH64
4242
/// </summary>
43-
LoongArch64
43+
LoongArch64,
44+
45+
/// <summary>
46+
/// A 32-bit ARMv6 processor architecture.
47+
/// </summary>
48+
Armv6,
49+
50+
/// <summary>
51+
/// A PowerPC 64-bit (little-endian) processor architecture.
52+
/// </summary>
53+
Ppc64le,
4454
}
4555
}

src/BenchmarkDotNet/Portability/RuntimeInformation.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,13 @@ internal static Runtime GetCurrentRuntime()
263263

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

272274
switch (ProcessArchitecture)
273275
{
@@ -285,6 +287,10 @@ public static Platform GetCurrentPlatform()
285287
return Platform.S390x;
286288
case LoongArch64:
287289
return Platform.LoongArch64;
290+
case Armv6:
291+
return Platform.Armv6;
292+
case Ppc64le:
293+
return Platform.Ppc64le;
288294
default:
289295
throw new ArgumentOutOfRangeException();
290296
}

0 commit comments

Comments
 (0)