Skip to content

Commit 9040e40

Browse files
authored
add RiscV64 support, fixes #2644 (#2647)
1 parent 52485ec commit 9040e40

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/BenchmarkDotNet/Environments/Platform.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,10 @@ public enum Platform
5151
/// A PowerPC 64-bit (little-endian) processor architecture.
5252
/// </summary>
5353
Ppc64le,
54+
55+
/// <summary>
56+
/// A RiscV 64-bit processor architecture.
57+
/// </summary>
58+
RiscV64,
5459
}
5560
}

src/BenchmarkDotNet/Portability/RuntimeInformation.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,13 @@ internal static Runtime GetCurrentRuntime()
207207
public static Platform GetCurrentPlatform()
208208
{
209209
// these are not part of .NET Standard 2.0, so we use hardcoded values taken from
210-
// https://github.com/dotnet/runtime/blob/1a37caf773a3b857ccff49a31be3333d4fdc491f/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs#L9
210+
// https://github.com/dotnet/runtime/blob/080fcae7eaa8367abf7900e08ff2e52e3efea5bf/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Architecture.cs#L9
211211
const Architecture Wasm = (Architecture)4;
212212
const Architecture S390x = (Architecture)5;
213213
const Architecture LoongArch64 = (Architecture)6;
214214
const Architecture Armv6 = (Architecture)7;
215215
const Architecture Ppc64le = (Architecture)8;
216+
const Architecture RiscV64 = (Architecture)9;
216217

217218
switch (ProcessArchitecture)
218219
{
@@ -234,6 +235,8 @@ public static Platform GetCurrentPlatform()
234235
return Platform.Armv6;
235236
case Ppc64le:
236237
return Platform.Ppc64le;
238+
case RiscV64:
239+
return Platform.RiscV64;
237240
default:
238241
throw new ArgumentOutOfRangeException();
239242
}

0 commit comments

Comments
 (0)