Skip to content

Commit d924bef

Browse files
committed
[Proto] Fixed ARM64 Compatibility for Proto
1 parent 628b06b commit d924bef

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Lagrange.Proto.Test/EncoderTest.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Buffers;
2+
using System.Runtime.Intrinsics.X86;
23
using Lagrange.Proto.Primitives;
34

45
namespace Lagrange.Proto.Test;
@@ -72,6 +73,8 @@ public void TestLongInt()
7273
[Test]
7374
public void TestReadTwoInt()
7475
{
76+
if (!Sse3.IsSupported) Assert.Ignore("SSE3 is not supported on this platform.");
77+
7578
var reader = new ProtoReader(_twoInt);
7679
var (number1, number2) = reader.DecodeVarIntUnsafe<int, int>(_twoInt);
7780

@@ -85,6 +88,8 @@ public void TestReadTwoInt()
8588
[Test]
8689
public void TestReadLongInt()
8790
{
91+
if (!Sse3.IsSupported) Assert.Ignore("SSE3 is not supported on this platform.");
92+
8893
var reader = new ProtoReader(_longInt);
8994
var (number1, number2) = reader.DecodeVarIntUnsafe<long, int>(_longInt);
9095

@@ -98,6 +103,8 @@ public void TestReadLongInt()
98103
[Test]
99104
public void TestUnsafeRead()
100105
{
106+
if (!Sse3.IsSupported) Assert.Ignore("SSE3 is not supported on this platform.");
107+
101108
Span<byte> longerBuffer = stackalloc byte[256];
102109
_longInt.AsSpan().CopyTo(longerBuffer);
103110

Lagrange.Proto/Primitives/ProtoWriter.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ public void WriteRawBytes(ReadOnlySpan<byte> bytes)
171171
[MethodImpl(MethodImplOptions.AggressiveInlining)]
172172
private unsafe void EncodeVarIntUnsafe<T>(T value) where T : unmanaged, INumberBase<T>
173173
{
174-
if (!Sse2.IsSupported) throw new PlatformNotSupportedException();
175-
176174
ulong v = ulong.CreateTruncating(value);
177175

178176
if (sizeof(T) <= 4)

0 commit comments

Comments
 (0)